Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikmpate0
Creator II
Creator II

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
Gysbert_Wassenaar

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
Partner - Champion
Partner - Champion

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
Creator II
Creator II
Author

Thank you

qlikmpate0
Creator II
Creator II
Author

Thank you.

MarcoWedel

Hi,

you could use

DayName(YourTimestampField)

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

hope this helps

regards

Marco