Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8247697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:56:15+00:00 2026-06-07T22:56:15+00:00

So now, its 9:23am. I have a UTC date string that represents the current

  • 0

So now, its 9:23am. I have a UTC date string that represents the current date, that looks like this "2012-07-17T09:23:27.75"

I want that in a date object, so I can display a nicely formatted date, so I:

var myDate = new Date("2012-07-17T09:23:27.75")
// Gives --> Tue Jul 17 2012 10:23:27 GMT+0100 (GMT Daylight Time)

So because of daylight saving time I’m getting an hour-out issue. I can see that myDate.getTimezoneOffset() gives me -60, what’s the standard / best practice way to get my date to actually reflect the current correct time? Have I just entered javascript date hell?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:56:17+00:00Added an answer on June 7, 2026 at 10:56 pm

    Try momentjs.com. I really found it handy for such things.

    var myDate = moment("2012-07-17T09:23:27.75");
    

    Gives you a date instance in your timezone (that basically configured on your computer). Moreover momentjs has nice human friendly formattings like “a couple of seconds ago”, “a month ago”,…

    Dates are really a hell in JS (but not only in JS). The best thing you can do is to always only transport in UTC between browser <-> server. Then on the server convert it to what time format you like, you obviously only have to be consistent. That way I managed to handle date-times properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what's the problem there, I have uploaded this video to server, but now its
The config below seemed to have worked but now its failing. I followed this
I have written a stored procedure in SQL Server. Now its just that I
ok I have this small code http://jsfiddle.net/laupkram/yJtyD/ now its not really working. I had
The first part of this question is now its own, here: Analyzing Text for
This is where the variables are defined, now its supposed to take in as
I have been working on an iOS App for sometime now and its almost
I've seen this on a few sites now and its puzzling me. The page
I want to pickle a file that sometime's is empty. Right now its empty,
I've done this a month before... But now its not working... The code is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.