Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date from Timestamp in qlik sense

Hi All,

I have a column having data in the format 2015-12-24T12:49:38+00:00. I want to extract date (2015-12-24) from this column. I have tried various functions (timestamp, timestamp#, etc) but none helped.

Could anyone help me get a solution for this.

Thanks in advance.

6 Replies
tresesco
MVP
MVP

Out of many possible ways, try :

MakeDate(SubField(YourDataField,'-',1), SubField(YourDataField,'-',2),TextBetween(YourDataField,'-','T')) as Date

reddy-s
Master II
Master II

Hi Disha,

You can even try this:

date(floor(date#('2015-12-24 12:49:38', 'YYYY-MM-DD hh:mm:ss')),'YYYY-MM-DD')

Not applicable
Author

Hi Tresesco,

I tried your solution but i am getting null as a result.

img.jpg

Regards,

Disha

simondachstr
Luminary Alumni
Luminary Alumni

To offer you another alternative (without suggesting it's the best):

Subfield(Data,'T',1) AS Date

This will work if T is a definitive separator between your Date & Time

tresesco
MVP
MVP

Try like:

Date(Date#(SubField(trim(endTime), 'T',1), 'YYYY-MM-DD')) As Date

reddy-s
Master II
Master II

Hi Disha,

You need to format the enddate field befor you use these functions.

Try this:

date(date#(left(endTime,10),'YYYY-MM-DD'),'YYYY-MM-DD')