Hello, everyone!
How to use JSL or formula to convert the text of column 1 into the time format of column 2.
Thanks!
Here is the formula for the conversion
Date DMY( Num( Substr( :date, 7, 2 ) ), Num( Substr( :date, 5, 2 ) ), Num( Substr( :date, 1, 4 ) ) ) + 60 * 60 * Num( Word( 2, :date, " :" ) ) + 60 * Num( Word( -1, :date, " :" ) )
@txnelson's formula will work but there's a slightly simpler formula that will work also.
This one uses Informat() to convert the date and time values.
Informat( Word( 1, :Column 1 ) ) +Informat( Word( 2, :Column 1 ), "h:m" )
How can JMP get the text of year, month and day from the date format?Sorry to bother you again,Thank you!
The Format() function is used to convert a JMP date, time or datetime value to a text string.
For example:
x=informat("20000214"); show(format(x, "m/d/y")); show(format(x, "d/m/y")); show(format(x, "Date Long")); show(format(x, "Monddyyyy"));
Results in this in the log:
Format(x, "m/d/y") = "02/14/2000"; Format(x, "d/m/y") = "14/02/2000"; Format(x, "Date Long") = "Monday, February 14, 2000"; Format(x, "Monddyyyy") = "Feb142000";
That's the style,Thanks!The effect is the same:format(x, "y/m/d") ———— format(x, "yyyyymmdd")