Tagged: insert date menu
- AuthorPosts
- September 5, 2023 at 6:48 am #29376jicParticipant
Greetings.
I would like to change the format of Insert/Date Time SHIFT-F5 menu to produce the YYYY-MM-DD HH:MM:SS.mmm instead of the default. Is this a possibility? Thanks.
josé
September 5, 2023 at 7:36 am #29377Patrick CParticipantI’ve got an old script that gets close, perhaps it helps.
// Inspired by & resources // https://www.emeditor.com/forums/topic/option-to-adjust-the-datetime-format-edit-insert-time-and-date/ // https://www.emeditor.com/forums/topic/insert-long-date/ // https://www.w3schools.com/jsref/jsref_tolocaledatestring.asp + jsref_getmonth.asp + jsref_getdate.asp function return_date_long_time() { var date = new Date(); // var n = d.toLocaleDateString(); // old approach - unreliable // Date assembly var dd = date.getDate(); // returns the day of the month (from 1 to 31) if( dd < 10 ) dd = "0" + dd; var MM = date.getMonth() + 1; // returns the month (from 0 to 11)! if( MM < 10 ) MM = "0" + MM; var yyyy = date.getFullYear(); // Returns the year (4 digits) // time assembly var hh = date.getHours(); // Returns the hour (from 0-23) if( hh < 10 ) hh = "0" + hh; var mm = date.getMinutes(); // Returns the minutes (from 0-59) if( mm < 10 ) mm = "0" + mm; var ss = date.getSeconds(); // Returns the seconds (from 0-59) if( ss < 10 ) ss = "0" + ss; // “Output” return( yyyy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss ); } document.write( return_date_long_time() );
September 5, 2023 at 9:01 am #29378jicParticipantThanks, Patrick. That is what I am doing now: Using a script to make it what I want. But, it would be nice if EmEditor would have an option to format the output to a desirable date, time or date+ time formats. Thanks, though.
September 7, 2023 at 3:53 am #29382Yutaka EmuraKeymasterYou can use the “Date and Time” command instead of the “Time and Date” command, and set the date/time format in the Format page of the Customize dialog box.
September 7, 2023 at 7:07 am #29384jicParticipantThanks. That is exactly what I was looking for.
September 8, 2023 at 4:56 am #29386jicParticipantBy the way, this is the option I chose: yyyy-MM-dd HH:mm:ss.ms which provides exactly what I want: 2023-09-08 07:54:27.5427
thanks.
November 28, 2023 at 10:00 am #29591jicParticipantSorry to bring this up again, but is there a way to bring the milliseconds in the Format page of the Customize dialog box? I tried ms but tat brings minus and seconds and puts them together.
- AuthorPosts
- You must be logged in to reply to this topic.