Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

How to split time and date?

This is the format I have. Now I want to split into Year, Month Year, Date, Week, Month and Time.

Can anyone help me out please.

Capture.JPG.jpg

1 Solution

Accepted Solutions
its_anandrjs
Not applicable

Re: How to split time and date?

If you have perfect timestamp filed then use

Date(DateField) as NewDateColumn,

Year(DateField) as Year,

Month(DateField) as Month,

MonthName(DateField) as MonthYear,

Week(DateField) as Week,

Time(DateField) as Time

5 Replies
venkatg6759
Not applicable

Re: How to split time and date?

For

Year use

Year(Fieldname)

MonthYear

monthName

Date  use

date or date# or timestamp or timestamp#

Week use

Week(fieldname)

month and time

Use

Month (Field) &' '& Time(Field)

Not applicable

Re: How to split time and date?

Try

Year(field),Month(field),Date(),Week(),Time() correspondingly

its_anandrjs
Not applicable

Re: How to split time and date?

Try with the scripts

LOAD

DateColumn,

Date(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT'),'MM-DD-YY') as NewDateColumn,

Year(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT')) as Year,

Month(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT')) as Month,

MonthName(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT')) as MonthYear,

Week(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT')) as Week,

Time(Mid(Timestamp#(DateColumn,'MM-DD-YY hh:mm TT'),10,5),'hh:mm') as Time;

LOAD * Inline

[

DateColumn

10-24-13 12:00 AM

10-25-13 12:00 AM

10-26-13 12:00 AM

10-27-13 12:00 AM

10-28-13 12:00 AM

10-29-13 12:00 AM

10-30-13 12:00 AM

];

its_anandrjs
Not applicable

Re: How to split time and date?

If you have perfect timestamp filed then use

Date(DateField) as NewDateColumn,

Year(DateField) as Year,

Month(DateField) as Month,

MonthName(DateField) as MonthYear,

Week(DateField) as Week,

Time(DateField) as Time

maxgro
Not applicable

Re: How to split time and date?

floor(field) to get the date

frac(field) to get the time