|  | Date and Time |  | |
| | | shapper |  |
| Posted: Thu Sep 04, 2008 9:12 pm Post subject: Date and Time |  |
Hello,
Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC?
I want to store Date/Time in UTC in the database but display it in local use Date/Time.
Thanks, Miguel |
| |
| | | Thomas 'PointedEars' Lahn |  |
| Posted: Thu Sep 04, 2008 9:12 pm Post subject: Re: Date and Time |  |
shapper wrote:
| Quote: | Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC?
|
Probably yes. Please define "UTC" and "user client zone".
PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee |
| |
| | | Dr J R Stockton |  |
| Posted: Thu Sep 04, 2008 10:49 pm Post subject: Re: Date and Time |  |
On Sep 4, 10:37 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote:
| Quote: | shapper wrote: Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC?
Probably yes. Please define "UTC" and "user client zone".
|
Is that ignorance or merely perversity? UTC is a standard term, and can be found in ISO/IEC 16262 with which you should be familiar (31 times, as a "word"; others as part of a method name). And "user client zone" makes aense in English, thogh "zone" must be talen as "region" and not "Time Zone" to be accurate.
OP : see in/via <URL:http://www.merlyn.demon.co.uk/js-dates.htm> and a Date Object Methods reference as there cited.
-- (c) John Stockton, near London, UK. Posting with Google. Mail: J.R.""""""""@physics.org or (better) via Home Page at Web: <URL:http://www.merlyn.demon.co.uk/> FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ... |
| |
| | | Thomas 'PointedEars' Lahn |  |
| Posted: Fri Sep 05, 2008 7:57 am Post subject: Re: Date and Time |  |
Dr J R Stockton wrote:
| Quote: | Thomas 'PointedEars' Lahn wrote: shapper wrote: Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? Probably yes. Please define "UTC" and "user client zone".
Is that ignorance or merely perversity?
|
It is a request.
| Quote: | UTC is a standard term, and can be found in ISO/IEC 16262 with which you should be familiar [...]
|
It matters which UTC and "user client zone" format is used here.
PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> |
| |
| | | Evertjan. |  |
| Posted: Fri Sep 05, 2008 6:46 pm Post subject: Re: Date and Time |  |
Steve wrote on 05 sep 2008 in comp.lang.javascript:
| Quote: | On Sep 5, 11:57 am, Thomas 'PointedEars' Lahn <PointedE...@web.de wrote: Dr J R Stockton wrote:
Is that ignorance or merely perversity?
It is a request.
I don't think you two realize how embarrassing your little tiff is to the rest of us. Please grow up, both of you.
|
Nonsense, only your own actions can be embarrasing on Usenet.
-- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) |
| |
| | | Steve |  |
| Posted: Fri Sep 05, 2008 6:57 pm Post subject: Re: Date and Time |  |
On Sep 5, 11:57 am, Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote:
| Quote: | Dr J R Stockton wrote:
Is that ignorance or merely perversity?
It is a request.
|
I don't think you two realize how embarrassing your little tiff is to the rest of us. Please grow up, both of you.
Steve. |
| |
| | | Dr J R Stockton |  |
| Posted: Fri Sep 05, 2008 8:22 pm Post subject: Re: Date and Time |  |
| |  | |
In comp.lang.javascript message <48C1028D.5070402@PointedEars.de>, Fri, 5 Sep 2008 11:57:33, Thomas 'PointedEars' Lahn <PointedEars@web.de> posted:
| Quote: | Dr J R Stockton wrote: Thomas 'PointedEars' Lahn wrote: shapper wrote: Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? Probably yes. Please define "UTC" and "user client zone".
Is that ignorance or merely perversity?
It is a request.
UTC is a standard term, and can be found in ISO/IEC 16262 with which you should be familiar [...]
It matters which UTC and "user client zone" format is used here.
|
You wrote nothing about "format". You should answer more slowly, allowing yourself time to think more about the question and your possible answers.
The OP may, but does not necessarily, want to convert between strings; my first thought was of converting, for example, the result of new Date(Y_UTC, ... , s_UTC) to what would have been given by new Date(Date.UTC(Y_UTC, ... , s_UTC)) and/or /vice versa/.
-- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk BP7, Delphi 3 & 2006. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links; <URL:http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htm> clpdmFAQ; NOT <URL:http://support.codegear.com/newsgroups/>: news:borland.* Guidelines |
| |
| | | Steve |  |
| Posted: Fri Sep 05, 2008 9:54 pm Post subject: Re: Date and Time |  |
On Sep 5, 10:46 pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
| Quote: | Steve wrote on 05 sep 2008 in comp.lang.javascript:
On Sep 5, 11:57 am, Thomas 'PointedEars' Lahn <PointedE...@web.de wrote: Dr J R Stockton wrote:
Is that ignorance or merely perversity?
It is a request.
I don't think you two realize how embarrassing your little tiff is to the rest of us. Please grow up, both of you.
Nonsense, only your own actions can be embarrasing on Usenet.
Hmmmm? OK, if you say so  |
|
| |
| | | Thomas 'PointedEars' Lahn |  |
| Posted: Sat Sep 06, 2008 2:54 pm Post subject: Re: Date and Time |  |
Dr J R Stockton wrote:
| Quote: | Thomas 'PointedEars' Lahn posted: Dr J R Stockton wrote: Thomas 'PointedEars' Lahn wrote: shapper wrote: Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? Probably yes. Please define "UTC" and "user client zone". Is that ignorance or merely perversity? It is a request.
UTC is a standard term, and can be found in ISO/IEC 16262 with which you should be familiar [...] It matters which UTC and "user client zone" format is used here.
[...] The OP may, but does not necessarily, want to convert between strings; [...]
|
Therefore I asked.
PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk> |
| |
| | | shapper |  |
| Posted: Sat Sep 06, 2008 11:16 pm Post subject: Re: Date and Time |  |
| |  | |
On Sep 6, 5:54 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote:
| Quote: | Dr J R Stockton wrote:
Thomas 'PointedEars' Lahn posted: Dr J R Stockton wrote: Thomas 'PointedEars' Lahn wrote: shapper wrote: Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? Probably yes. Please define "UTC" and "user client zone". Is that ignorance or merely perversity? It is a request.
UTC is a standard term, and can be found in ISO/IEC 16262 with which you should be familiar [...] It matters which UTC and "user client zone" format is used here.
[...] The OP may, but does not necessarily, want to convert between strings; [...]
Therefore I asked.
PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk
|
Hello,
I have seen this happening, a few times with me, both in CSS and Javascript groups.
A discussion starts for nothing ... I will say what I usually say. Go to the beach and relax ... :-)
Anyway, back to what is important. First of all let me say that I am not Javascript expert. My problem is:
On my MVC application I have a few web pages with forms which has inputs for date and time on the following format:
"2008-09-14 23:05:37"
On my database I save all dates and times in UTC (http://www.iso.org/ iso/date_and_time_format) format.
However I need to:
1. Convert the UTC Date/Time in a form input to the Time Zone of the user. This should be done after the form is loaded so the value is there.
2. Convert the Date/Time string inserted by the user from its TimeZone to UTC and replace it in the input when the form is submitted. This way on my server side code I will get the correct Date/Time to insert in the database.
I know this can't be done on the server side. On the server side I am not able to get the Local Time Zone. Only UTC.
Note: When I say conversion I mean that in UTC 2008-09-13 23:10:40 might be 2008-09-14 02:10:40 ...
Thanks, Miguel |
| |
| Page 1 of 2 .:. Goto page 1, 2 Next | |
|
|