How to get timezone with Espruino #286
Replies: 12 comments
-
Posted at 2014-04-25 by DrAzzy The Espruino doesn't know what the current date and time is until you tell it, let alone the time zone. It also doesn't keep time well enough to use as a clock without an external crystal - see http://www.espruino.com/Clocks I know someone else here was working on a Date module that might be useful. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-25 by @gfwilliams As @drazzy says, Martin has actually just made a module that implements the date object - so just what you're after. He's submitted it so it'll go live on the website early next week. It's probably best to wait until that's up, as it comes with some example code too... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-26 by user6933 How exactly would you 'tell it' the date and time? That is what I am getting at |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-26 by Sacha Maybe you need a RTC Chip like this: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-26 by DrAzzy They have example code on the clock page I linked to above, under the software section - of course, that's without the new date module... I haven't seen the date module, so I don't know how that would be different. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-28 by @gfwilliams @sacha - Espruino has an RTC inside it already - so no need for that. All you need is some code that'll convert the time in seconds to a proper date + time. I'll try and get that uploaded today. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-28 by Sacha Oh. Thanks. Sacha |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-29 by mgg1010 Also check this - currentmillis.com/api/millis-since-unix-epoch.php If you have ethernet, you can use this to get the time without requiring NTP |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-29 by vstef_is the Date / Clock modules are very useful - and I am sorry to bump an older thread... but... is it me or there is no getSeconds exported on Date ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-30 by @gfwilliams Argh. Thanks for letting me know - it was a mistake in the code where getSeconds got exported over the top of getMinutes. It'll be fixed in 1v66, but it should be relatively easy to fake with:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-30 by mgg1010 Thanks for fixing :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-30 by vstef_is Sure, I just wanted to post this so you know as well :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-04-25 by user6933
Does anyone know how to get the current timezone e.g. current date and time with Espruino... I have had a look at the reference and there is only a getTime(); function which gets you the time in seconds since the device has been booted up... As Espruino doesn't have the JavaScript
Date
function does anyone know how we can get the current Date and Time?p.s. I am new to this
Beta Was this translation helpful? Give feedback.
All reactions