- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Regards,
Chandan
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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