cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-694172%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E6%97%A5%E4%BB%98%E6%99%82%E5%88%BB%20yyyymmdd_hhmmss%20%E3%81%AE%E5%BD%A2%E5%BC%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-694172%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E3%81%94%E3%81%8D%E3%81%92%E3%82%93%E3%82%88%E3%81%86%E3%80%81%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECSV%20%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E4%BF%9D%E5%AD%98%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%AE%E6%97%A5%E4%BB%98%E3%81%A8%E6%99%82%E5%88%BB%E3%81%AE%E5%BD%A2%E5%BC%8F%E3%81%AB%E5%95%8F%E9%A1%8C%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3CBR%20%2F%3E%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D%E3%81%AF%E3%80%8C%E3%80%8D%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3CSTRONG%3E%E6%A6%82%E8%A6%81_20231103_082637%3C%2FSTRONG%3E%20%E3%80%8D%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%20formattedDate%20%3D%20Format(Today()%2C%20%22yyyymmdd_hhmmss%22)%3B%3CBR%20%2F%3E%20filename%20%3D%20Convert%20File%20Path(%22C%3A%5CPath%5Csummary_%22%20%7C%7C%20formattedDate%20%7C%7C%20%22.xlsx%22%2C%20%E7%B5%B6%E5%AF%BE%20)%3B%3CBR%20%2F%3E%20if(%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%8C%E5%AD%98%E5%9C%A8%E3%81%99%E3%82%8B%20(%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D)%2C%3CBR%20%2F%3E%20dt%20%26lt%3B%26lt%3B%20Save%20(%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D%2C%20Mode(%22Append%22))%2C%3CBR%20%2F%3E%20dt%20%26lt%3B%26lt%3B%20%E4%BF%9D%E5%AD%98%20(%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D))%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%3E%3CBR%20%2F%3E%E6%97%A5%E6%99%82%E3%82%92%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%E3%81%97%E3%82%88%E3%81%86%E3%81%A8%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%3CBR%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EformatDate%20%3D%20Format(Today()%2C%20%22yyyymmdd%22)%3B%3CBR%20%2F%3E%E8%A1%A8%E7%A4%BA(%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%E6%97%A5%E4%BB%98)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%E7%B5%90%E6%9E%9C%EF%BC%9A%E3%80%8C20231103%E3%80%8D%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Eformat1%20%3D%20Format(Today()%2C%20%22h%3Am%3As%22)%3B%3CBR%20%2F%3E%E8%A1%A8%E7%A4%BA(%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%881)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%E7%B5%90%E6%9E%9C%3A%20%E3%80%8C%E5%8D%88%E5%BE%8C%206%20%E6%99%82%2018%20%E5%88%86%2032%20%E7%A7%92%E3%80%8D%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Eformat2%20%3D%20Format(Today()%2C%20%22%3CYYYY%3E%3CMM%3E%3CDL%3E%3CDD%3E%26lt%3B-%26gt%3B%3CHH24%3E%3CMM%3E%3CSS%3E%22)%3B%3CBR%20%2F%3E%E8%A1%A8%E7%A4%BA(%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%882)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%E7%B5%90%E6%9E%9C%3A%E3%80%8C2023%2F11%2F03%E3%80%8D%3C%2FSS%3E%3C%2FMM%3E%3C%2FHH24%3E%3C%2FDD%3E%3C%2FDL%3E%3C%2FMM%3E%3C%2FYYYY%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-694172%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E8%87%AA%E5%8B%95%E5%8C%96%E3%81%A8%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E4%BD%9C%E6%88%90%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-694177%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%E6%97%A5%E4%BB%98%E6%99%82%E5%88%BB%20yyyymmdd_hhmmss%20%E3%81%AE%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-694177%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%82%8BJMP%E3%81%AE%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%81%AF%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%9B%E3%82%93%E3%81%8C%E3%80%81%E5%8F%AF%E8%83%BD%E3%81%A7%E3%81%82%E3%82%8C%E3%81%B0%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%BE%E3%81%99%EF%BC%88JMP16%E3%81%A7%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%9F%E3%81%A8%E6%80%9D%E3%81%84%E3%81%BE%E3%81%99%EF%BC%89%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0Aformatted_date%20%3D%20Format(Today()%2C%20%22Format%20Pattern%22%2C%20%22%3CYYYY%3E%3CMM%3E%3CDL%3E%3CDD%3E_%3CHH24%3E%3CMM%3E%3CSS%3E%22)%3B%0A%3CP%3E%E5%B8%B8%E3%81%AB%E6%A9%9F%E8%83%BD%E3%81%99%E3%82%8B%E4%BB%96%E3%81%AE%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AF%E3%80%81%20Year()%E3%80%81Month()%E3%80%81Day()%20%E3%81%AA%E3%81%A9%E3%81%AE%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E6%96%87%E5%AD%97%E5%88%97%E3%81%A8%E3%81%97%E3%81%A6%E6%9C%80%E5%88%9D%E3%81%8B%E3%82%89%E6%A7%8B%E7%AF%89%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3C%2FSS%3E%3C%2FMM%3E%3C%2FHH24%3E%3C%2FDD%3E%3C%2FDL%3E%3C%2FMM%3E%3C%2FYYYY%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Celine1
Level II

Format Date Time yyyymmdd_hhmmss

Greetings,

 

I am having an issue with a date-time format when save a csv file.
The filename should be like "Summary_20231103_082637".

formattedDate = Format(Today(), "yyyymmdd_hhmmss");
filename = Convert File Path("C:\Path\Summary_" || formattedDate || ".xlsx", absolute );
if(File Exists (filename),
dt << Save (filename, Mode("Append")),
dt << Save (filename));



I tried to format the datetime with

formatDate = Format(Today(), "yyyymmdd");
Show(formatDate);

Result: "20231103"

format1 = Format(Today(), "h:m:s");
Show(format1);

Result: "6:18:32 PM"

format2 = Format(Today(), "<YYYY><MM><DD><-><hh24><mm><ss>");
Show(format2);

Result: "11/03/2023"

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Format Date Time yyyymmdd_hhmmss

You don't indicate which JMP version you have, but if possible I would use Format Pattern (I think it was added in JMP16)

Names Default To Here(1);
formatted_date = Format(Today(), "Format Pattern", "<YYYY><MM><DD>_<hh24><mm><ss>");

Other option which will work always, is to build it from start as a string using functions such as Year(), Month(), Day(), and so on

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Format Date Time yyyymmdd_hhmmss

You don't indicate which JMP version you have, but if possible I would use Format Pattern (I think it was added in JMP16)

Names Default To Here(1);
formatted_date = Format(Today(), "Format Pattern", "<YYYY><MM><DD>_<hh24><mm><ss>");

Other option which will work always, is to build it from start as a string using functions such as Year(), Month(), Day(), and so on

-Jarmo

Recommended Articles