Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date & Time Field

How to split my Date into two fields Date and Time field?

4-2-2015 3-35-44 PM.jpg

1 Solution

Accepted Solutions
Not applicable
Author

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:

   

NewDateTime
03/24/201412:15
04/22/201409:10

View solution in original post

9 Replies
kiranmanoharrode
Creator III
Creator III


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

pokassov
Specialist
Specialist

Hi!

date(floor(date))

and

time(frac(date))

Sergey

arulsettu
Master III
Master III

hi

use this to get date

date(date#('03/23/2015 12:03','MM/DD/YYYY HH:MM'))

Not applicable
Author

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

arulsettu
Master III
Master III

try this for time

=Date(Time#('03/23/2015 12:03','MM/DD/YYYY HH:MM'),'HH:MM')

Anonymous
Not applicable
Author

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')

Not applicable
Author

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:

   

NewDateTime
03/24/201412:15
04/22/201409:10

Not applicable
Author

Thanks Uday !!

Not applicable
Author

You are welcome Murali