GW
Junior Member
Posts: 4
Registered: 9/18/2003
Member Is Offline
|
| posted on 9/19/2003 at 12:21 AM |
|
|
UTC time - is it possible?
The calendar is a great little widget and so easy to use 'right out of the box'. I want users to submit a timestamp using the calendar...
and this part works fantastic!
But I'm stuck now and I wish the code was easier to customize.
Here's a synopsis of my problem: Different users in different parts of the country submit a date is based on their locale, and because the Tigra
calendar is a client side javascript the server has to figure out who comes from where. But the server doesn't know the answer!
For example a user in New York opens the calendar and timestamps 9-18-2003 2:00:00 AM, but at the same time a user in San Fransisco might open the
calendar and their timestamp is 9-17-2003 23:00:00 PM.
So I've been stuck on trying to use the javascript toUTCString to let the user timestamp their local time, and then submit the timestamp back to
me as a UTC string. UTC incorporates the Greenwich Mean Time and I think it automatically figures out what the difference will be.
I don't need the exact minutes and seconds, since I'm going to reformat the time field with a dropdown showing 96x15 minute intervals in a
24 hour day. So I just have convert the returned date to a UTCString in javascript. And parse it if someone opens the calendar a second time
(optional).
Can someone give me a hint for what part of calendar1.js I need to edit in order to accomplish this?
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 9/24/2003 at 01:14 PM |
|
|
To return data in UTC format you should set in cal_gen_tsmp1 function istead of
return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
the following:
return
(Date.UTC(dt_datetime.getFullYear(),dt_datetime.getMonth(),dt_datetime.getDate(),dt_datetime.getHours(),dt_datetime.getMinutes(),dt_datetime.getSecond
s()));
|
|
|
GW
Junior Member
Posts: 4
Registered: 9/18/2003
Member Is Offline
|
| posted on 9/26/2003 at 12:37 AM |
|
|
Hi Nik,
Thanks for your reply. That's pretty cool!
I am saving the date in my server's database as a UTC date and the user selects a date in their local time. Excellent!
But now the really hard part.
How can I parse the saved UTC date so that when the user wants to modify a saved (UTC) date they can modify it in their local time? Sort of the
reverse of posting data in UTC format...
GW
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 9/29/2003 at 09:29 AM |
|
|
It requires some code changes. Our specialists are ready to do it for low hourly rates.
|
|
|
GW
Junior Member
Posts: 4
Registered: 9/18/2003
Member Is Offline
|
| posted on 9/29/2003 at 11:52 PM |
|
|
Tigra Calendar UTC
Hi Nik,
I purchased the PRO version. It's a great product I just wish it could do the UTC time conversions.
I've been emailing with Denis about this. Could you speak with him and get back to me with an answer?
Thanks.
GW
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 9/30/2003 at 07:12 AM |
|
|
Hi, GW! We've received your post and will answer you via email.
|
|
|