Solved

How to get the zome from time as EST?

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL  on Tomcat 8 68
What's wrong with this code? 4 26
Java Eclipse Loop 3 20
restrict decimal places for double datatype 10 19
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

839 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