www.webdeveloper.com
Results 1 to 3 of 3

Thread: Dates

  1. #1
    Join Date
    Mar 2011
    Posts
    20

    Angry Dates

    I hate dates

    So, I have stored dates in my SQL database using GETUTCDATE() which appears to be working fine.
    I then created a function that basically gets the JavaScript milliseconds for any date I store. This was simply for doing sorting and filtering.

    So, when I create a new Date() object in JavaScript using my milliseconds and call the toLocaleString() function, I get something like:

    Tue Oct 30 2012 01:37:57 GMT+0000 (GMT STANDARD TIME)

    now, what I would like is this.
    I want it to show something like :

    Tue Oct 30 2012 01:37:57

    and if the person viewing my site has their regional settings set to GMT + 0200 I want the time to be displayed for them in their region:

    Tue Oct 30 2012 03:37:57

    I have been searching for ages and I just can't find anything to do it.
    I thought that date.js would work, but it can't handle the "(GMT STANDARD TIME)" which is a shame.

    anyway,
    Any help would be greatly appreciated.

    /r3plica

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,254

    Question

    I'm not sure I understand your problem.
    When I run the following script, I get exactly what you want...
    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <title> Untitled </title>
    <script type="text/javascript">
    var now = new Date();
    alert(now.toLocaleString());
    </script>
    </head>
    <body>
    
    </body>
    </html>
    The time displays for my own time zone without any adjustments.

    Do you have an example that shows the error you are getting?
    Is you browser set-up to show something different?

  3. #3
    Join Date
    Mar 2011
    Posts
    20
    it appears to be a problem in chrome:

    http://code.google.com/p/chromium/is...%20Mstone%20OS

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles