Hey,
how do i format the current time to GMT 0 timezone with using the NGRE in javascript?
this is what i have now
'use strict';
load(Java.type("java.lang.System").getenv("OPENHAB_CONF")+'/automation/lib/javascript/core/rules.js');
var me = "003_test_date_format.js";
JSRule({
name: "Test Date Format",
description: "Line: "+__LINE__,
triggers: [
TimerTrigger("0/15 * * * * ?") // 15 seconds
],
execute: function( module, input){
var now = new Date().toUTCString();
//var format = now.format("yyyy-MM-dd");
logInfo("Date Format: ", now);
}
});
which gives me in the log:
'Thu, 30 May 2019 09:08:45 GMT'
thanks for your help
EDIT.
found a way to get the current time in GMT
So the questions is now… how to format that in “YYYY-MM-DD HH:MM” ?