Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qlikmpate0
Contributor

grouping date only not the time element

How can one group dates  in scripting

My example is I have several dates including the time, but I only want to show data for each day and ignore the time?

Hope this makes sense.

regards

M

5 Replies

Re: grouping date only not the time element

You can use the floor function to cut of the time part from a date:

date(floor(MyDateTime),'DD-MM-YYYY') as MyDate

If your datetime (timestamp) field doesn't contain numeric values but text values you can use the date# function to turn the text values into dates. You'll still should use the floor function. Date(floor(date#(MyField, 'YYYYMMDD hhmmss')),'DD-MM-YYYY')

Note, all the date and timestamp formats above are just examples. Use the formats you actually need.


talk is cheap, supply exceeds demand
awhitfield
Esteemed Contributor

Re: grouping date only not the time element

Hi Mina,

you can strip out the hh:mm:ss etc, and just keep the date

an example of this is:

FixDate:
Load * inline
[
TimeStamp
24/02/1958 11:12:32
]
;

FinalDate:

Load
TimeStamp,
Date(Floor(TimeStamp)) as NewDate
Resident FixDate;

Gives a new date of 24/02/1958 from 24/02/1958 11:12:32

Regards

Andy

qlikmpate0
Contributor

Re: grouping date only not the time element

Thank you

qlikmpate0
Contributor

Re: grouping date only not the time element

Thank you.

Re: grouping date only not the time element

Hi,

you could use

DayName(YourTimestampField)

to purge the time part from the timestamp and format as a date

hope this helps

regards

Marco

Community Browser