Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Out of many possible ways, try :
MakeDate(SubField(YourDataField,'-',1), SubField(YourDataField,'-',2),TextBetween(YourDataField,'-','T')) as Date
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')
Hi Tresesco,
I tried your solution but i am getting null as a result.
Regards,
Disha
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
Try like:
Date(Date#(SubField(trim(endTime), 'T',1), 'YYYY-MM-DD')) As Date
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')