Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mtfisch7864
Contributor
Contributor

Date conversion in load script

Hi all,

Can't seem to convert  a text timestamp format 'DD MMM YYYY hh:mm:ss' to a timestamp 'MM/DD/YYYY HH:MM:SS'. The 3 character month 'Jan', etc. does not translate to the equivalent month number? What am I doing wrong. I'm using the timestamp function. 

1 Solution

Accepted Solutions
avinashelite

Try like this 

Timestamp (Timestamp#(time_field, 'DD MMM YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm:ss') as new_field,

 

If it's not working share the same data

View solution in original post

5 Replies
Vegar
MVP
MVP

Check the definitions of your variable MonthNames. 

Your short month names (Jan, Feb etc.) need to correspond to the MonthNames system variable.

 

avinashelite

Try like this 

Timestamp (Timestamp#(time_field, 'DD MMM YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm:ss') as new_field,

 

If it's not working share the same data

MayilVahanan

HI,

Try like below, it will helps you

Script:

Timestamp(Timestamp#(YourFieldName, 'DD MMM YYYY hh:mm:ss'),'MM/DD/YYYY hh:mm:ss') as YourFieldName

Sample: Timestamp(Timestamp#('09 Sep 2020 16:09:54','DD MMM YYYY hh:mm:ss'),'MM/DD/YYYY hh:mm:ss') gives result as "09/09/2020 16:09:54". 

Thanks & Regards,

Mayil Vahanan R

 

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
mtfisch7864
Contributor
Contributor
Author

Thank you - works beautifully!

avinashelite

Welcome !!