Date GMT +1 only got GMT

Hi friends,

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()+"]";

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 = + (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()+"]";

Thanks friend,

I tried to do that but I couldn’t get it there I saw the error where I was doing it.

As I have detailed, it is what I was looking for, thank you very much.

Another small question I do not know if you will know how to help me.

I have thought about saving a variable which can be updated and when it is restarted it can be recovered.

Looking only I see that the solution is to add sql, but it is for some basic numeric variables I do not know if there is another option.

Some simple way that doesn’t mess up the code too much.

Thank you so much for everything

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.

hmm it really depends what you’re using the variable for. If you only need to store a small number of values then serverside JSON should be enough.

Yes, it would be a very small thing to remember the basic configuration settings exactly for tmi .js could you give me an example in json?

JSON is very similar to how objects are written in javascript.
An example json file would be:

  "name": "John Doe",
  "age": 40,
  "jobs": [

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

Well friend, thank you very much for your help.

No problem, glad I could help :^)