Solved

How to get the zome from time as EST?

Posted on 2011-03-16
4
299 Views
Last Modified: 2012-08-13
Hi,
I get the date and the time as the following:

java.lang.String geckUpdateDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm Z").format(new java.util.Date());

Open in new window


And it returns me something like:

2011-03-17 00:39 -0400

However I would like to get

2011-03-17 00:39 EST

or

2011-03-17 00:39 EDT

depending on either "Eastern Time" or "Eastern Daylight Time"

How can I make it in Java?

Thanks,
0
Comment
Question by:Tolgar
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 35153818


Try using lower case "z" or "zzz"
java.lang.String geckUpdateDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm z").format(new java.util.Date());

java.lang.String geckUpdateDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm zzz").format(new java.util.Date());
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35153828
Yes, works for me either with one "z" or with three "zzz"
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35154752
0
 
LVL 92

Expert Comment

by:objects
ID: 35155399
you just need to specify the appropriate date format string as for_yan has explained above
The capital Z you are using specified RFC822 format which is not what you want
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now