[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get the zome from time as EST?

Posted on 2011-03-16
4
Medium Priority
?
313 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

873 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