-
• #2
A workaround could be:
var date = new Date(); var future = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0); console.log(future.toString());
Best
Tobias
-
• #3
Hi - yes, at the moment that's what you'd have to do I'm afraid.
I've filed a bug for this though - so at some point I will add the setters. It'd make life a lot easier!
-
• #4
Great, thank you Gordon!
-
• #5
I've been playing with the date functions because I am trying to build an IP connected clock but I am having a nightmare. Probably the fact that I don't normally code but the references don't seem to work very well in practical applications. Once I've figured things out I should share what I've found but I don't have much time to work on it.
-
• #6
references don't seem to work very well in practical applications.
What do you mean by that?
-
• #7
Espruino - Pico user:
As a beginner I want to ask about the following construction (taken from MDM)...
var birthday = new Date('December 17, 1995 03:24:00');
But console.log( birthday.toString()); results in Thu Jan 1 1970 00:00:00 GMT+0000.
Is the contruction with 'December 17, 1995 03:24:00' not possible? -
• #8
Looks like
Dec 17, 1995 03:24:00
works butDecember 17, 1995 03:24:00
doesn't.I've just fixed this so it'll be in 1v81 of Espruino. Looks like JavaScript only really checks the first 3 characters, so for instance this should also work:
(new Date('Decfdsm 17, 1995 03:24:00')).toString()
-
• #9
Thank you for the fast response :-)
Hello again,
I experienced that the Date class has no setters like:
How can I create a new Date() object for example for today, but time of day 12:00 for example?
In regular JavaScript I write something like this:
In Espruino this doesn't work :(
Best,
Tobias