![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
My D-Link DSL-302G modem/router has a real-time clock whose settings are volatile. To avoid hand keying the date/time via the modem's JS interface, I wonder if there is a way to copy the JS code to the hard drive and modify it to automatically retrieve the PC's date/time. I could then add the hacked JS page to my browser's bookmarks. I've already successfully modified and adapted other modem menus, but I don't know how to go about this particular task (I'm not a programmer). |
#3
| |||
| |||
|
|
I need a small JS routine that reads the PC date/time and builds a URL in this format: http://10.1.1.1/Action?sysm_date_che...dSubmit=Submit The date in the above example is Sep 3, 2005 and the time is 22:2:22. Daylight saving is on. The time zone is "EAST +1000 Eastern Australian Standard". |
|
Thanks in advance for any assistance. |
#4
| |||
| |||
|
|
OK, I've narrowed down my requirements to the following: I need a small JS routine that reads the PC date/time and builds a URL in this format: http://10.1.1.1/Action?sysm_date_che...ys_year=2005&s ysm_time_check=&sys_hour=22&sys_minute=2&sys_secon d=22&timezone_combo=42&dst=1&h ost_name=DSL-302G&dom_name=HomeLAN&id=1&cmdSubmit=Submit The date in the above example is Sep 3, 2005 and the time is 22:2:22. Daylight saving is on. The time zone is "EAST +1000 Eastern Australian Standard". Thanks in advance for any assistance. |
#5
| ||||
| ||||
|
|
JRS: In article <qeo4u19qqm33uec44dp1fn1rnn10dc2djn (AT) 4ax (DOT) com>, dated Fri, 3 Feb 2006 07:04:09 remote, seen in news:comp.lang.javascript, Franc Zabkar <fzabkar (AT) iinternode (DOT) on.net> posted : OK, I've narrowed down my requirements to the following: I need a small JS routine that reads the PC date/time and builds a URL in this format: http://10.1.1.1/Action?sysm_date_che...ys_year=2005&s ysm_time_check=&sys_hour=22&sys_minute=2&sys_secon d=22&timezone_combo=42&dst=1&h ost_name=DSL-302G&dom_name=HomeLAN&id=1&cmdSubmit=Submit The date in the above example is Sep 3, 2005 and the time is 22:2:22. Daylight saving is on. The time zone is "EAST +1000 Eastern Australian Standard". Thanks in advance for any assistance. Did you consider reading the newsgroup FAQ before posting? See sig below. |
|
EAST is in fact not a time zone, AFAICS; a time zone is the set of all places which have the same winter offset from GMT/UTC/UT. AIUI, the Eastern third of Australia is in the GMT+10 zone, and remains in that zone even in Summer when parts of it change their local time to GMT+11. You appear to be in a part which has Summer Time. You may need to send the Standard Time even in Summer, or you may need to send the civil time. Timezone_combo is not to me an obvious concept. |
|
You may want to consider the possibility of moving your system or giving your code to a colleague elsewhere, in which case be sure not to hard- code the local Time Rules. |
|
Your PC is liable to indicate Winter Time from 2006-03-26, though AIUI the change will be a week later. A sensibly-designed router would want to be sent the time in ISO 8601 UTC format, i.e. as 2005-09-03 22:02:22Z ; presumably yours is imported from a chronologically-inept location. There's no difficulty in generating such a string from the information in the Date Object D resulting from D = new Date() but your example is not adequate to indicate the full requirement. For example, does DST=1 mean that it *is* summer, or that the location changes offset for summer. If the latter, how does it know when to change offset - maybe DST rules are built in ... !! |
#6
| |||
| |||
|
|
Franc Zabkar wrote: I need a small JS routine that reads the PC date/time and builds a URL in this format: http://10.1.1.1/Action?sysm_date_che...dSubmit=Submit The date in the above example is Sep 3, 2005 and the time is 22:2:22. Daylight saving is on. The time zone is "EAST +1000 Eastern Australian Standard". One possibility: var sBaseURI = "http://10.1.1.1/Action?sysm_date_check=", d = new Date(), aMonths = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], sFullURI = [ baseURI, "&sys_month=", aMonths[d.getMonth()], "&sys_date=", d.getDate(), "&sys_year=", d.getFullYear(), "&sysm_time_check=&sys_hour=", d.getHours(), "&sys_minute=", d.getMinutes(), "&sys_second=", d.getSeconds(), "&timezone_combo=", whatever_that_is, "&dst=", left_as_an_exercise_to_the_reader, "&host_name=DSL-302G&dom_name=HomeLAN&id=1&cmdSubmit=Submit" ].join(""); Thanks in advance for any assistance. RTFM next time. |
|
PointedEars |
#7
| |||
| |||
|
|
[...] Thomas 'PointedEars' Lahn [...] wrote: [Full quote] |
|
RTFM next time. Thanks very much for your help ... I think. As I confessed elsewhere, I have absolutely no knowledge of HTML, JS, or C, so RTFM would be a big ask. I'd liken it to asking someone at comp.lang.swahili to translate a couple of sentences of English and being told to consult a dictionary. |
#8
| |||
| |||
|
|
[...] Anyway, after a considerable struggle, I came up with this: |
#9
| |||
| |||
|
|
Franc Zabkar wrote: [...] Anyway, after a considerable struggle, I came up with this: Considerable struggle? |
|
Your code is essentially mine, without even mentioning it! |
| http://www.users.on.net/~fzabkar/DSL-302G/TimeSync.htm Hopefully you aware that you will probably set the wrong time half of the year. |
#10
| |||
| |||
|
|
Franc Zabkar wrote: [...] Thomas 'PointedEars' Lahn [...] wrote: [Full quote] Read the FAQ and the FAQ Notes before you post here again. RTFM next time. Thanks very much for your help ... I think. As I confessed elsewhere, I have absolutely no knowledge of HTML, JS, or C, so RTFM would be a big ask. I'd liken it to asking someone at comp.lang.swahili to translate a couple of sentences of English and being told to consult a dictionary. The logical course of action would be to attend Swahili classes or just let it be. For the purpose of this newsgroup is not to compensate your lack of basic knowledge _and_ your unwillingness to acquire it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |