Getting OS real Date as game variables

Is there a way to get the real OS date as game variables with scripts?
Date.Now() should do it for you

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
How could i use it im a message?
You'd have to set the game variable with a script call prior to showing the message (unless MV has added an easier way to do it, I don't know.) Without being able to test, somthing like...

Code:
dateStr = new Date().toDateString();
$gameVarables.setValue(id, dateStr);


'id' is the variable ID. The ecma functions are implementation defined, so how you'll have to decide whether or not you like how that is formatted. If not, you can roll your own.

Code:
var d = new Date();
var day = d.getDate();
// month is zero indexed
var month = d.getMonth() + 1;
var year = d.getFullYear();

var dateStr = day + "-" + month + "-" + year;
$gameVarables.setValue(id, dateStr);

Now you can use the standard message switch (\v[id]? I forget) to show it in the message.

Original thread: https://forums.rpgmakerweb.com/threads/getting-os-real-date-as-game-variables.88004/