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-84776%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EComment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84776%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EBonjour%20%C3%A0%20tous!%3C%2FP%3E%3CP%3EComment%20utiliser%20JSL%20ou%20une%20formule%20pour%20convertir%20le%20texte%20de%20la%20colonne%201%20dans%20le%20format%20d'heure%20de%20la%20colonne%202.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci!%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222018-11-30_22-27-38.png%22%20style%3D%22width%3A%20779px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222018-11-30_22-27-38.png%22%20style%3D%22width%3A%20779px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222018-11-30_22-27-38.png%22%20style%3D%22width%3A%20779px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F14655i41B6AFADC1D54FDD%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222018-11-30_22-27-38.png%22%20alt%3D%222018-11-30_22-27-38.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376895%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376895%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20un%20format%20qui%20fonctionnera%20avec%20les%20exemples%20que%20vous%20avez%20fournis.Il%20devra%20%C3%AAtre%20modifi%C3%A9%20pour%20d'autres%20combinaisons%20de%20valeurs%20et%20de%20structure.Ci-joint%20un%20exemple%20de%20tableau%20de%20donn%C3%A9es%20avec%20la%20formule%20appliqu%C3%A9e%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EIf(%20Row()%20%3D%3D%201%2C%0A%20moList%20%3D%20%7B%22January%22%2C%20%22February%22%2C%20%22March%22%2C%20%22April%22%2C%20%22May%22%2C%20%22June%22%2C%20%22July%22%2C%0A%20%22August%22%2C%20%22September%22%2C%20%22October%22%2C%20%22November%22%2C%20%22December%22%7D%3B%0A%20moAbvList%20%3D%20%7B%22Jan%22%2C%20%22Feb%22%2C%20%22Mar%22%2C%20%22Apr%22%2C%20%22May%22%2C%20%22Jun%22%2C%20%22Jul%22%2C%20%22Aug%22%2C%20%22Sep%22%2C%0A%20%22Oct%22%2C%20%22Nov%22%2C%20%22Dec%22%7D%3B%0A)%3B%0AIf(%0A%20Word(%203%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20%3D%3D%20%22%22%2C%0A%20%20theDay%20%3D%20Num(%20Substr(%20%3AMdfc%2C%201%2C%202%20)%20)%3B%0A%20%20theMonth%20%3D%20Contains(%20moAbvList%2C%20Substr(%20%3AMdfc%2C%204%2C%203%20)%20)%3B%0A%20%20theYear%20%3D%20Num(%20Word(%20-1%2C%20%3AMdfc%2C%20%22abcdefghijklmnopqrstuvwxyz%22%20)%20)%3B%0A%20%20Show(%20theday%2C%20themonth%2C%20theyear%2C%20Substr(%20%3AMdfc%2C%204%2C%203%20)%20)%3B%2C%0A%20Is%20Missing(%20Num(%20Word(%202%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%20)%20%3D%3D%201%2C%0A%20%20theDay%20%3D%20Num(%20Word(%201%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20%20theMonth%20%3D%20Contains(%20moList%2C%20Word(%202%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20%20theYear%20%3D%20Num(%20Word(%203%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%2C%0A%20Is%20Missing(%20Num(%20Word(%201%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%20)%20%3D%3D%201%2C%0A%20%20theDay%20%3D%20Num(%20Word(%202%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20%20theMonth%20%3D%20Contains(%20moList%2C%20Word(%201%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20%20theYear%20%3D%20Num(%20Word(%203%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%2C%0A%20theDay%20%3D%20Num(%20Word(%202%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20theMonth%20%3D%20Num(%20Word(%201%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A%20theYear%20%3D%20Num(%20Word(%203%2C%20%3AMdfc%2C%20%22%20%2F-%22%20)%20)%3B%0A)%3B%0ADate%20MDY(%20theMonth%2C%20theDay%2C%20theYear%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376832%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376832%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EJ'ai%20une%20donn%C3%A9e%20avec%20une%20variable%20qui%20peut%20inclure%20diff%C3%A9rents%20types%20de%20dates.%3CBR%20%2F%3E%20Exemple%26nbsp%3B%3A%3CBR%20%2F%3E%2017%20janvier%202015%3CBR%20%2F%3E%20Ou%3CBR%20%2F%3E%2012-6%2F2013%3CBR%20%2F%3E%20Ou%3CBR%20%2F%3E%2020%20janvier%201997%3CBR%20%2F%3E%20Ou%3CBR%20%2F%3E%2026%20mars%202001%3CBR%20%2F%3E%20Ou%3CBR%20%2F%3E%2023-12-1991%3CBR%20%2F%3E%20Ils%20seront%20modifi%C3%A9s%20dans%20le%20code.%3CBR%20%2F%3E%20Donc%2C%20j'ai%20besoin%20d'avoir%20la%20date%20au%20format%20AAAA-MM-JJ%20dans%20ma%20deuxi%C3%A8me%20variable.%3CBR%20%2F%3E%3CBR%20%2F%3E%20La%20premi%C3%A8re%20var%20est%20Mdfc%3CBR%20%2F%3E%20Deuxi%C3%A8me%20Var%20est%20Fdtc%3CBR%20%2F%3E%3CBR%20%2F%3E%20Pouvez-vous%20aider%20%C3%A0%20avoir%20la%20solution%3F%3CBR%20%2F%3E%20Merci%20!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84902%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84902%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EC'est%20le%20style%2C%20merci%20!%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%20L'effet%20est%20le%20m%C3%AAme%20%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%20format(x%2C%20%22a%2Fm%2Fj%22)%20%E2%80%94%E2%80%94%E2%80%94%E2%80%94%3C%2FSPAN%3E%20format(x%2C%20%22aaaaammjj%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84883%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84883%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ELe%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F14%2Fdate-and-time-functions.shtml%232531887%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%20Format()%3C%2FA%3E%20fonction%20est%20utilis%C3%A9e%20pour%20convertir%20un%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJMPer-Cable%2FUsing-dates-times-datetimes-and-durations-in-JMP%2Fba-p%2F68689%22%20target%3D%22_self%22%3E%20Date%2C%20heure%20ou%20date%2Fheure%20JMP%3C%2FA%3E%20%C3%A0%20une%20cha%C3%AEne%20de%20texte.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPar%20exemple%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ex%3Dinformat(%2220000214%22)%3B%0A%0Ashow(format(x%2C%20%22m%2Fd%2Fy%22))%3B%0A%0Ashow(format(x%2C%20%22d%2Fm%2Fy%22))%3B%0A%0Ashow(format(x%2C%20%22Date%20Long%22))%3B%0A%0Ashow(format(x%2C%20%22Monddyyyy%22))%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ER%C3%A9sultats%20dans%20ceci%20dans%20le%20journal%26nbsp%3B%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EFormat(x%2C%20%22m%2Fd%2Fy%22)%20%3D%20%2202%2F14%2F2000%22%3B%0AFormat(x%2C%20%22d%2Fm%2Fy%22)%20%3D%20%2214%2F02%2F2000%22%3B%0AFormat(x%2C%20%22Date%20Long%22)%20%3D%20%22Monday%2C%20February%2014%2C%202000%22%3B%0AFormat(x%2C%20%22Monddyyyy%22)%20%3D%20%22Feb142000%22%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84875%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84875%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EVotre%20question%20est%20vague.%20Veuillez%20donner%20un%20exemple%20de%20ce%20%C3%A0%20quoi%20ressemblent%20les%20valeurs%20d'entr%C3%A9e%20et%20de%20ce%20que%20vous%20voulez%20que%20la%20valeur%20de%20sortie%20soit...%E2%80%A6.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84865%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84865%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EComment%20JMP%20peut-il%20obtenir%20le%20texte%20de%20l'ann%C3%A9e%2C%20du%20mois%20et%20du%20jour%20%C3%A0%20partir%20du%20format%20de%20date%26nbsp%3B%3F%3CBR%20%2F%3E%20D%C3%A9sol%C3%A9%20de%20vous%20d%C3%A9ranger%20encore%2C%20merci%20!%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%222018-12-04_22-10-39.png%22%20style%3D%22width%3A%20312px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222018-12-04_22-10-39.png%22%20style%3D%22width%3A%20312px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222018-12-04_22-10-39.png%22%20style%3D%22width%3A%20312px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F14680iE047F7CDBE905FDD%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222018-12-04_22-10-39.png%22%20alt%3D%222018-12-04_22-10-39.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84805%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84805%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EMerci!%3CBR%20%2F%3E%20Jim%20Faites-moi%20conna%C3%AEtre%20le%20principe%2C%20Jeff_Perkinson%20laissez-moi%20apprendre%20la%20fonction%20JMP.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84799%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84799%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%2F2687%22%20target%3D%22_blank%22%3E%40txnelson%3C%2FA%3E%20La%20formule%20de%20fonctionnera%2C%20mais%20il%20existe%20une%20formule%20l%C3%A9g%C3%A8rement%20plus%20simple%20qui%20fonctionnera%20%C3%A9galement.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMPScreenSnapz300.png%22%20style%3D%22width%3A%20726px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPScreenSnapz300.png%22%20style%3D%22width%3A%20726px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPScreenSnapz300.png%22%20style%3D%22width%3A%20726px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F14661i7EBCFD2ABAB3F5B8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22JMPScreenSnapz300.png%22%20alt%3D%22JMPScreenSnapz300.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ECelui-ci%20utilise%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F14%2Fdate-time-functions.shtml%23123225%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%20Informer()%3C%2FA%3E%20pour%20convertir%20les%20valeurs%20de%20date%20et%20d'heure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EInformat(%20Word(%201%2C%20%3AColumn%201%20)%20)%20%2BInformat(%20Word(%202%2C%20%3AColumn%201%20)%2C%20%22h%3Am%22%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84780%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84780%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20la%20formule%20de%20conversion%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EDate%20DMY(%0A%20Num(%20Substr(%20%3Adate%2C%207%2C%202%20)%20)%2C%0A%20Num(%20Substr(%20%3Adate%2C%205%2C%202%20)%20)%2C%0A%20Num(%20Substr(%20%3Adate%2C%201%2C%204%20)%20)%20)%20%2B%20%0A%2060%20*%2060%20*%20Num(%20Word(%202%2C%20%3Adate%2C%20%22%20%3A%22%20)%20)%20%2B%20%0A%2060%20*%20Num(%20Word(%20-1%2C%20%3Adate%2C%20%22%20%3A%22%20)%20)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84777%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Comment%20convertir%20des%20nombres%20au%20format%20texte%20au%20format%20aaaammjj%20hh%3Amm%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84777%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ELes%20noms%20de%20colonne%20dans%20le%20diagramme%20doivent%20%C3%AAtre%3CBR%20%2F%3E%20aaaammjj%20hh%3Amm%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
lwx228
Level VIII

How to convert text format Numbers to yyyymmdd hh:mm format?

Hello, everyone!

How to use JSL or formula to convert the text of column 1 into the time format of column 2.

 

Thanks!

2018-11-30_22-27-38.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

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, " :" ) )
Jim

View solution in original post

Jeff_Perkinson
Community Manager Community Manager

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

@txnelson's formula will work but there's a slightly simpler formula that will work also.

 

JMPScreenSnapz300.png

This one uses Informat() to convert the date and time values. 

 

 

Informat( Word( 1, :Column 1 ) ) +Informat( Word( 2, :Column 1 ), "h:m" )

 

-Jeff

View solution in original post

10 REPLIES 10
lwx228
Level VIII

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

The column names in the diagram should be
yyyymmdd hh:mm
txnelson
Super User

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

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, " :" ) )
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

@txnelson's formula will work but there's a slightly simpler formula that will work also.

 

JMPScreenSnapz300.png

This one uses Informat() to convert the date and time values. 

 

 

Informat( Word( 1, :Column 1 ) ) +Informat( Word( 2, :Column 1 ), "h:m" )

 

-Jeff
lwx228
Level VIII

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

Thanks!
Jim Let me know the principle, Jeff_Perkinson let me learn JMP function.
lwx228
Level VIII

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

How can JMP get the text of year, month and day from the date format?
Sorry to bother you again,Thank you!

 

2018-12-04_22-10-39.png

 

 

 

txnelson
Super User

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

Your question is vague. Please give an example of what the input values looks like, and what you want the output value to be...….
Jim
Alina199121
Level I

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

I have one data with one varieble that can inculde diferent types of dates.
Exmple:
17 January 2015
Or
12-6/2013
Or
20.Jan1997
Or
March 26 2001
Or
12-23-1991
They will changed in code.
So, I need to have date in YYYY-MM-DD format in my second variable.

First var is Mdfc
Second Var is Fdtc

Can you help to have the solution?
Thank you !
txnelson
Super User

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

Here is a format that will work with the examples you provided.  It will have to be tweaked for other combinations of values and structure.  Attached is a sample data table with the formula applied

If( Row() == 1,
	moList = {"January", "February", "March", "April", "May", "June", "July",
	"August", "September", "October", "November", "December"};
	moAbvList = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
	"Oct", "Nov", "Dec"};
);
If(
	Word( 3, :Mdfc, " /-" ) == "",
		theDay = Num( Substr( :Mdfc, 1, 2 ) );
		theMonth = Contains( moAbvList, Substr( :Mdfc, 4, 3 ) );
		theYear = Num( Word( -1, :Mdfc, "abcdefghijklmnopqrstuvwxyz" ) );
		Show( theday, themonth, theyear, Substr( :Mdfc, 4, 3 ) );,
	Is Missing( Num( Word( 2, :Mdfc, " /-" ) ) ) == 1,
		theDay = Num( Word( 1, :Mdfc, " /-" ) );
		theMonth = Contains( moList, Word( 2, :Mdfc, " /-" ) );
		theYear = Num( Word( 3, :Mdfc, " /-" ) );,
	Is Missing( Num( Word( 1, :Mdfc, " /-" ) ) ) == 1,
		theDay = Num( Word( 2, :Mdfc, " /-" ) );
		theMonth = Contains( moList, Word( 1, :Mdfc, " /-" ) );
		theYear = Num( Word( 3, :Mdfc, " /-" ) );,
	theDay = Num( Word( 2, :Mdfc, " /-" ) );
	theMonth = Num( Word( 1, :Mdfc, " /-" ) );
	theYear = Num( Word( 3, :Mdfc, " /-" ) );
);
Date MDY( theMonth, theDay, theYear );
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: How to convert text format Numbers to yyyymmdd hh:mm format?

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";

 

 

-Jeff

Recommended Articles