Yeah, I'm still not getting it.
I've looked back on this thread. Some help.
Moment node
But I am (typically) missing something.
Adding slight insult to injury it is 11:49 here and I am not really wanting to wait 1:10 to test what I am doing.
I know, I know I know. ZULU time is the preferred time format.
When you are 10/11 hours off ZULU and your brain isn't too good most of the time, it is annoying when (for instance) I am looking at a log at 07:20 local and I am seeing an entry (the last one) with yesterday's date.
It really throws me.
I'd just prefer to stamp things with LOCAL time.
I also know that I've asked this before and have probably got answers.
Finding them, the code which was modified and rolling it out is/are another story/ies.
Yes: my problem. I get it.
But there must be a way.
I get how the moment
node works.
I can get the date time coming out the way I like it and it looks good.
Alas being 11:51 (now) local, am still not 100% sure it is what I want.
The appendage of AM/PM is not welcome on time stamps.
I am wanting YY MM DD HH mm ss
output. As is specified in moment
.
To get local time I have got/use var d = new Date().toLocaleString();
(where d
stores the value) All good.
Well, kind of.
If I want to use the date/time as a file name I make it this:
var d = new Date().toLocaleString().replace(/:/g,"");
which strips the :
from the format.
I seem to remember that this pesky AM
and PM
are sneaking in.
So with the code I posted, how do I force it to be 24 format? (HH
rather than hh
)
I'm now looking at this site:
Date/time format
But it is Greek to me.
I'm not getting the syntax.
I'm also wanting two digit dates/times if they are single.
It is mentioned but explained how to get it.