Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

node.js returns GMT time and not local time for “new Date()” #3044

Closed
jaseemabid opened this issue Mar 31, 2012 · 2 comments
Closed

node.js returns GMT time and not local time for “new Date()” #3044

jaseemabid opened this issue Mar 31, 2012 · 2 comments

Comments

@jaseemabid
Copy link

I am getting the following result for a "new Date()"

  • Node : "Sat, 31 Mar 2012 21:39:53 GMT "
  • Browser : "Sun Apr 01 2012 03:17:56 GMT+0530 (IST)"

I am expecting the browser version from node

  • node version : v0.6.12
  • os : Debian unstable

Installed node with the package manager with default configuration.

@TooTallNate
Copy link

This is just the Date's repl representation, which calls .toGMTString(). This is actually changed on the master branch to match how browsers do it:

☮ ~ (master) ⚡ node
> process.version
'v0.7.7'
> new Date
Sat Mar 31 2012 15:03:32 GMT-0700 (PDT)

@Phatsin
Copy link

Phatsin commented May 24, 2012

> new Date()
Thu, 24 May 2012 09:37:40 GMT
>' '+ new Date()
'Thu May 24 2012 16:37:41 GMT+0700 (ICT)'
> ""+ new Date()
'Thu May 24 2012 16:37:45 GMT+0700 (ICT)'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants