Solved

How to get the zome from time as EST?

Posted on 2011-03-16
4
298 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

708 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

15 Experts available now in Live!

Get 1:1 Help Now