Post 4 made on Monday January 19, 2009 at 22:10 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
Barry,
Are you sure about the time being correct? IIRC, there's an offset in milliseconds that is set during download time that will cause Hours and Minutes to be adjusted but early prontoscript experience for sure proved to me that the M,D,and Y, were not valid. The only thing I could rely on from the Date() constructor that was valid, IIRC, is seconds.
To get hour and minute, you must use GUI.getDisplayTime() and then break it apart for either a 12 or 24 hour clock.
Here's some code I used in the past to do this.
// Extract from GUI.getDisplayTime(), the hour, minute, and 'am' or 'pm'. // In case of 24 hour clock, variable ampm will be either an empty string, null, or // undefined - TBD by your own debugging.
var timePattern = new RegExp('(\\d+):(\\d+)((am|pm)*)','g'); GUI.getDisplayTime().match(timePattern); var hour = parseInt(RegExp.$1,10); var minute = parseInt(RegExp.$2,10); var ampm = RegExp.$3; var seconds = new Date().getSeconds();
|
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|