• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timezone conversion  RSS feed

 
Jacob Sonia
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this program



Here i am getting a time with a timezone and the timezone is in UTC, is that a correct assumption
the output is as follows, why is not as per the input
2013-10-15T12:43 -0600
1381862580000
2013-10-15T12:43 -0600


 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob Sonia wrote:Here i am getting a time with a timezone and the timezone is in UTC, is that a correct assumption

I'm not sure what you mean, but I would say no, nothing there is in UTC. Except the strings -0600 and -0700 both reference timezones relative to UTC, if that's what you mean.
the output is as follows, why is not as per the input

Jacob Sonia wrote:2013-10-15T12:43 -0600
1381862580000
2013-10-15T12:43 -0600

You mean, why does it not use UTC-0700? Because you've requested that outFormat format the output using America/Denver, which currently gives Mountain Daylight Time, which is UTC-0600. If you want it to use a different time zone, identify the time zone you want to use, and tell the formatter to use that time zone.

Note that there is no difference in value between the date you call "date" and the one you call "mstTime". They represent exactly the same thing. Neither one has a time zone associated with it - Date objects never do. (Except when toString() is called on them, and the system default time zone is used.)

Try this:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!