| Author |
Timestamp advanced 4 hours
|
majid nakit
Ranch Hand
Joined: Jun 26, 2001
Posts: 160
|
|
Hi, Timestamp ts = new Timestamp(new Date().getTime()); I am displaying the Timestamp , but instead of showing : Last Update: 2007-10-09 13:29:32.0 it shows Last Update: 2007-10-09 17:29:32.0 can you please help me. thanks
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Looks like a timezone problem.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
majid nakit
Ranch Hand
Joined: Jun 26, 2001
Posts: 160
|
|
Hi, I am living here in Est Cost, but still get the UTC time, 4 hours ahead. how to set the time to be my local time. thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
|
|
Check which time zone you are using See whether that helps at all.
|
 |
majid nakit
Ranch Hand
Joined: Jun 26, 2001
Posts: 160
|
|
Hi, America/New_York wich is the correct time for Boston, but when I run my project in Netbeans, I got 4 hours ahead.
|
 |
Kamal Ahmed
Ranch Hand
Joined: Feb 15, 2005
Posts: 90
|
|
|
Where did you import Timestamp from?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
Originally posted by majid nakit: I am displaying the Timestamp , ...
How are you displaying the timestamp? You can use a DateFormat object to format a date any way you like, and set the timezone on the DateFormat object to show it in a specific timezone. For example:
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Timestamp advanced 4 hours
|
|
|