Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to split my Date into two fields Date and Time field?
Hey Murali,
You can try like this
Table:
Load *,
Date(Floor(Subfield(date, ' ',1)), 'MM/DD/YYYY') as NewDate,
Timestamp(Subfield(date,' ',2),'hh:mm') as Time;
Load * Inline [
date
03/24/2014 12:15
04/22/2014 09:10
];
output:
NewDate | Time |
03/24/2014 | 12:15 |
04/22/2014 | 09:10 |
Hi Murali,
Use TimeStamp#() function for extracting Date from respective field;
for extracting date:
=Date(TimeStamp#(date,'MM/DD/YYYY HH:MM))
it will extract Date in format defined in 1st main tab of scripting (Default date format for Document)
Further extraction of time use Hour() and Minutes() functions
Regards,
Kiran
Hi!
date(floor(date))
and
time(frac(date))
Sergey
hi
use this to get date
date(date#('03/23/2015 12:03','MM/DD/YYYY HH:MM'))
Hi @Murali srithar
Try this code
Load *,
Date#(SubField(STARTDATETIME,' ',1),'DD/MM/YYYY') as Date,
Month(Date#(SubField(STARTDATETIME,' ',1),'DD/MM/YYYY')) as Month,
Time(SubField(STARTDATETIME,' ',2) )as Time;
or
You can also use combination of timestamp() and date()
Like
date(timestamp(timestamp#(dateFieldName,''M/D/YYYY h:mm))) as NewDate
try this for time
=Date(Time#('03/23/2015 12:03','MM/DD/YYYY HH:MM'),'HH:MM')
Date Part : DayName(date)
Time Part : date(date,'HH:MM:SS')
if this doesnt work then try this
Date Part : DayName(date#(date,'MM/DD/YYYY HH:MM'))
Time Part : date(date#(date,'MM/DD/YYYY HH:MM'),'HH:MM:SS')
Hey Murali,
You can try like this
Table:
Load *,
Date(Floor(Subfield(date, ' ',1)), 'MM/DD/YYYY') as NewDate,
Timestamp(Subfield(date,' ',2),'hh:mm') as Time;
Load * Inline [
date
03/24/2014 12:15
04/22/2014 09:10
];
output:
NewDate | Time |
03/24/2014 | 12:15 |
04/22/2014 | 09:10 |
Thanks Uday !!
You are welcome Murali