convert date to EST

how to convert the date to EST time zone?what is EDT?

Thu May 12 12:32:33 EDT 2015
LVL 20
chaitu chaituAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EST is the daylight saving version of EDT. As it happens, that style of timezone id is deprecated. Use the America/X version, e.g. America/New_York

SimpleDateFormat (see API docs) allows you to set a TimeZone
chaitu chaituAuthor Commented:
is it correct?

DateFormat df1 = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy");
                         Date dt= df1.parse("Thu May 12 12:32:33 EDT 2015");

                         String result = df1.format(dt);
If you're creating a Date, you don't need to set a TimeZone on the DateFormat, unless you're converting. It's difficult  to see what your goal is
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

is it correct?
Your code looks ok. But, you probably want to use "America/New_York"
chaitu chaituAuthor Commented:
issue is one server is in UTC time zone and another server is in EST time zone.

the request is coming from the UTC time zone and the object is  in the form of xmlgregoriancalendar object.i want to convert into EST time zone and save it into DB.
It's conceivable that you only need to change the XMLGregorianCalendar timezone
chaitu chaituAuthor Commented:
how to convert EST time zone in INT..
import java.util.*;

public class Offset {
    public static void main(String[] args) {
        TimeZone tz = null;

        if (args.length < 1) {
            tz = TimeZone.getDefault();
        } else {
            tz = TimeZone.getTimeZone(args[0]);

        final int HOURS_IN_MILLISECOND = 1000 * 60 * 60;
        System.out.printf("Raw offset (hours) = %d. Daylight saving now? %b%n",
            tz.getRawOffset() / HOURS_IN_MILLISECOND,
            tz.inDaylightTime(new Date()));

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.