How to apply dateFormat YYMMDDHHmmss
Hi,
I am currently trying to develop a service that should generate a number consisting of a date shorened to yymmddhhmm.
When writing the bellow code in javascript (nodejs)
const date = new Date();
console.log("SSNDate: "+date.toLocaleString("sv-SE", { timeZone: "Europe/Stockholm" }).slice(2).replace(/\s|\.|:|-/g,""));
I get
230929090129
With this code:
dateFormat(date, "YYMMDDHHmm")
I get
23092720756
I would also like my code to take locale and timeZone into account, how is that done?
Calling new Date, I get what I understand looks like a unix timestamp:
1695974346423
To summarize:
- How to format a date according to YYMMDDHHmmss?
- How to take a certain timezone into account?
- What is date returning?
- How to take timeZone and locale into account, rhinos implementation does not seem to do it the standard way with toLocaleString.
- What dateStrings can be used with dateFormat, and how to check that?
Regards
Oskar Berntorp


