cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Sarah_Gagne
Level I

Convert Character Timestamp to Numeric Date

I've read through past discussion posts trying to find a solution to converting a timestamp that is character/nominal into a date that is numeric/ordinal. So far I've tried the following approaches without success:

  • Reimporting the .CSV with numeric/ordinal selected
  • Formula using informat and format
  • Recoding

Does anyone have a formula suggestion that I can use to transform 'Timestamp' into the format identified in 'Ideal Timestamp'?

2 REPLIES 2
jthi
Super User

Re: Convert Character Timestamp to Numeric Date

Use Word + In Format

In Format(Word(1, :Timestamp, " "), "YYYYMMDD")

jthi_1-1744730374526.png

You can also try to play around with Format Pattern but it might not work due to milliseconds. If you wish to have the time left, use word with "." separator and modify the format for informat as necessary

-Jarmo
txnelson
Super User

Re: Convert Character Timestamp to Numeric Date

Here is one way to handle this.

Create a numeric column and set the format to be displayed to

       yyyy-mm-dd

Then set the columns formula to

Date MDY(
	Num( Substr( :Timestamp, 5, 2 ) ),
	Num( Substr( :Timestamp, 7, 2 ) ),
	Num( Substr( :Timestamp, 1, 4 ) )
)

txnelson_0-1744730921230.png

 

Jim

Recommended Articles