cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-550053%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EConversi%C3%B3n%20de%20AM%2FPM%20a%20formato%20de%2024%20horas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-550053%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHola%20usuario%20de%20JMP%2C%3C%2FP%3E%3CP%3E%C2%BFPuede%20sugerir%20c%C3%B3mo%20convertir%20la%20hora%20AM%2FPM%20al%20formato%20de%2024%20horas%3F%3C%2FP%3E%3CP%3EEn%20la%20siguiente%20tabla%2C%20la%20columna%201%20est%C3%A1%20en%20el%20tipo%20de%20datos%20%22Car%C3%A1cter%22%20y%20quiero%20convertirlo%20en%20formato%20de%2024%20horas%20(h%3A%20m%3A%20s).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22chandankishor66_0-1664360632850.png%22%20style%3D%22width%3A%20147px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F45866iAA691940AFF240B8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22chandankishor66_0-1664360632850.png%22%20alt%3D%22chandankishor66_0-1664360632850.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ESaludos%2C%3C%2FP%3E%3CP%3EChand%C3%A1n%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-550053%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3Esecuencias%20de%20comandos%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-550057%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Conversi%C3%B3n%20de%20AM%2FPM%20a%20formato%20de%2024%20horas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-550057%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESi%20sus%20datos%20siempre%20son%20as%C3%AD%20y%20solo%20quiere%20las%20horas%2C%20usar%C3%ADa%20la%20f%C3%B3rmula%20con%20Word%20o%20Words%20y%20luego%20calcular%C3%ADa%20los%20valores%20juntos.%20Un%20ejemplo%20a%20continuaci%C3%B3n%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENum(Word(1%2C%20%3AColumn%201))%20%2B%20If(Word(2%2C%20%3AColumn%201)%20%3D%3D%20%22PM%22%2C%2012%2C%200)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-551481%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Conversi%C3%B3n%20de%20AM%2FPM%20a%20formato%20de%2024%20horas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-551481%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%20te%20dio%20una%20buena%20respuesta%20para%20exactamente%20lo%20que%20estabas%20buscando%20hacer.%20Sin%20embargo%2C%20es%20una%20buena%20pr%C3%A1ctica%20usar%20tiempos%20de%20almacenamiento%20en%20una%20columna%20de%20tiempo.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EObt%C3%A9n%20m%C3%A1s%20informaci%C3%B3n%20sobre%20c%C3%B3mo%20hacerlo%3A%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJMPer-Cable%2FUsing-dates-times-datetimes-and-durations-in-JMP%2Fm-p%2F68689%23U68689%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-blog-thread%20lia-fa-icon%20lia-fa-blog%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3E%20Uso%20de%20fechas%2C%20horas%2C%20fechas%20y%20duraciones%20en%20JMP%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
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