Hi, I need some help with time. I have a dropdown list that shows various times so the user can select the time most relevant to their needs, but the system pre-selects the current time
- <%
-
Dim MyTime : MyTime = FormatDateTime(now, 3) 'returns current date/time
-
%>
-
-
<tr>
-
<td class="body" align="right"><strong>Select Time In:</strong></td>
-
<td>
-
<select name="customer_arrivaltime">
-
<option selected="selected" value="<%=MyTime%>"><%=MyTime%></option>
-
<option value="05:30:00 AM">5:30 AM</option> <option value="05:45:00 AM">5:45 AM</option>
-
<option value="06:00:00 AM">6:00 AM</option> <option value="06:15:00 AM">6:15 AM</option>
-
<option value="06:30:00 AM">6:30 AM</option> <option value="06:45:00 AM">6:45 AM</option>
-
<option value="07:00:00 AM">7:00 AM</option> <option value="07:15:00 AM">7:15 AM</option>
-
<option value="07:30:00 AM">7:30 AM</option> <option value="07:45:00 AM">7:45 AM</option>
-
-
<option value="8:00:00 PM">8:00 PM</option>
-
</select>
-
</td>
-
</tr>
This works great, except that I was an idiot and set it up to use the server time. The server is in the central time zone, now I have users on the east coast so the current pre-selected time is wrong. Bah.
So, I need to use the time on the users PC. It does not need to be atomically accurate, I don’t mind if the users PC has the wrong time. I have been playing with this javascript
- <script type="text/javascript">
-
var newtime;
-
var d = new Date();
-
newtime = d.toLocaleTimeString();
-
document.write(newtime);
-
</script>
it produces the time in the format I want, but I can't figure out how to get the (newtime) results to appear in my dropdown so the user still sees their current time first.
can someone help? is there a better way to do this?
TIA
Path