cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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