A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java 8 in Action
this week in the
Java in General
How to get Pacific Date from GMT ?
Joined: Mar 20, 2003
Mar 27, 2003 17:32:00
I have a calendar with GMT date.
I need to get the Pacific(-8) time equivalent for the HOURS field.
How can I do that ?
Joined: Oct 08, 2001
Mar 28, 2003 11:32:00
Look into javadocs for
class. Your code might look something like this:
TimeZone tz = TimeZone.getTimeZone("EST"); TimeZone.setDefault(tz); Calendar rightNow = Calendar.getInstance(); int hour = rightNow.get(Calendar.HOUR_OF_DAY); int min = rightNow.get(Calendar.MINUTE); int day = rightNow.get(Calendar.DAY_OF_WEEK);
It is sorta covered in the
JavaRanch Style Guide
subject: How to get Pacific Date from GMT ?
How can I get the midnight GMT time
java.util.Date on different JVMs on different timezones
Help with System Time
Date vs Calendar
DST issue with GregorianCalendar
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014