I am trying to log the date and time GMT + 1 but I have only got GMT from the server, I see no option to put another strip.
Me code:
var fecha = new Date();
var console = “[”+fecha.getDate()+"/"+(fecha.getMonth()+1)+"/"+fecha.getFullYear()+"]["+fecha.getHours() +":"+fecha.getMinutes()+":"+fecha.getSeconds()+"]";
Hey!
What you are doing currently gets the Date for the timezone the computer executing it is currently set to, so if your computer is set to GMT, the time returned will be in GMT.
If you want the date to always be in GMT+1 you can use this solution:
// This will get the milliseconds since midnight 1 Jan 1970 UTC (GMT) and add an offset of 60 minutes
var offset = Date.now() + (60 * 60000) /* 60000 ms in a minute*/
var fecha = new Date(offset)
var console = "["+fecha.getUTCDate()+"/"+(fecha.getUTCMonth()+1)+"/"+fecha.getUTCFullYear()+"]["+fecha.getUTCHours() +":"+fecha.getUTCMinutes()+":"+fecha.getUTCSeconds()+"]";
You can use either the localStorage API which stores values for a specific page. You can read about it on MDN.
To create or access a variable in the Storage object through the localStorage api you can simply do localStorage.variableName = value
Checking if the browser supports it in code is as simple as an if statement with typeof(Storage) !== "undefined" (true if supported)
Once the project responds, I will test it, you see that they are experiencing problems glitch, if it does not work, which option would you recommend? to save and remove variable.
I have been watching low db but would not know how to adapt it.
On server-side you’d have to read in the file with something like the fs package and then use JSON.parse()
Here’s some further reading on MDN and on how to load it serverside on Stack Overflow