Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Zone Select Box

Status
Not open for further replies.

webmigit

Programmer
Aug 3, 2001
2,027
US
I have this code that I wrote in cold fusion to do a timezone selection...

Code:
  The current time (US, Eastern Standard Time) is <font color="red">#dateformat(now(),"mm/dd/yy")#, #timeformat(now(),"hh:mm tt")#.<br><br>

  <select name="timeOffset"><cfloop from="-7" to="17" index="moveTime">
    <option value="#moveTime#">(#moveTime#:00) #dateformat(DateAdd("h",moveTime,Now()),"m/d")# at #timeformat(DateAdd("h",moveTime,Now()),"h:mm tt")#</option></cfloop>
  </select>

And I'd like to do the same thing in javascript... this seems like something that would be better for the client side to handle.. But Javascript is very different from the languages I use and I'm pretty lost on where to start (Where most languages use lcase(string).. javascript uses something to the effect of string.ToLowerCase().. and things like that... that's taking some getting used to).

What I want to do is populate a select box with times offsetting from current time.. offset starting at -7 ending at 17.

Any ideas?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 

Where most languages use lcase(string).. javascript uses something to the effect of string.ToLowerCase()

Of course, by "most languages", you mean most languages that have no object-based, or object-oriented structure to them. Welcome to the world of OO.

Doing this task is fine in JavaScript, but in all honesty, I'd stick with your CFM - for the simple reason that it is server-side, and so will work in browsers that have JS disabled.

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top