Results 1 to 4 of 4
Thread: UTC Dates
- 04-01-2010, 12:51 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 1
- Rep Power
- 0
UTC Dates
Hello.
I already search by this topic in the forum searh engine , and i have found a lot of issues related with this topic but none of these have clarified me.
I read that when you create a Date object like this away Date d = new Date(); , that will contain the date in UTC(number of miliseconds since 01/01/1970), but when i simple
do System.out.println(d) this will print the date in my local machine timezone.
How can I have a Date object with the UTC time ?
Thanks
- 04-01-2010, 01:16 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Use SimpleDateFormat to format the date string output. If you read the API docs for Date and it's toString method (which is what at work there) it clearly states that the date will presented in the machines local timezone, but the actual date object is still a UTC Date Time representation, you are simply seeing the String representation of that time in your timezone when you use toString().
- 04-01-2010, 01:25 PM #3
Cross posted
Java Programming - UTC Dates
UTC Dates - Java Programming Forums
db
- 04-01-2010, 06:08 PM #4
Similar Threads
-
Times without dates.
By JavaJuJitZu in forum Advanced JavaReplies: 14Last Post: 01-17-2010, 10:54 PM -
Adding dates how can i do that
By kirtichopra2003 in forum Advanced JavaReplies: 7Last Post: 10-12-2009, 11:27 AM -
Difference of Two Dates
By jboy in forum New To JavaReplies: 3Last Post: 09-15-2009, 06:41 PM -
JTable and Dates
By paluee in forum AWT / SwingReplies: 0Last Post: 03-30-2009, 08:02 PM -
Help with dates
By bumblyb33 in forum New To JavaReplies: 1Last Post: 02-13-2009, 02:54 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks