cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
chandankishor66
Level III

Conversion of AM/PM to 24 hrs format

Hello JMP user,

Can you please suggest how to convert the time AM/PM to 24 hrs format.

In below table, column 1 is in "Character" Data Type and I want to convert it in 24hrs (h:m:s) format. 

 

chandankishor66_0-1664360632850.png

Regards,

Chandan

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Conversion of AM/PM to 24 hrs format

If your data is always like that and you just want the hours, I would use formula with Word or Words and then just calculate the values together. One example below:

Num(Word(1, :Column 1)) + If(Word(2, :Column 1) == "PM", 12, 0);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Conversion of AM/PM to 24 hrs format

If your data is always like that and you just want the hours, I would use formula with Word or Words and then just calculate the values together. One example below:

Num(Word(1, :Column 1)) + If(Word(2, :Column 1) == "PM", 12, 0);
-Jarmo
Jeff_Perkinson
Community Manager Community Manager

Re: Conversion of AM/PM to 24 hrs format

@jthi gave you a good answer for exactly what you were looking to do. However, it's a good practice to use a store times in a time column. 

 

Learn more about how to do that: Using dates, times, datetimes and durations in JMP 

-Jeff

Recommended Articles