Posted By:
joey_corleon
Posted On:
Saturday, October 12, 2002 04:48 AM
Hi, I am developing a web application in which I convert all the dates into UTC (a unsigned long representing a date) for storing in a database (in the database, the dates are represtned as UTC). How shall I do this? The major bean provides me with: [year][month][day][hour][minute][seconds] The JAVA doc says: public static long UTC(int year, int month, int date, int hrs, int min, int sec) Deprecated . As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date, hrs, min, sec) or GregorianCalendar(year + 1900, month, date, hrs, min, sec), using a UTC TimeZone, followed by Calendar.getTime().getTime() But I don't get this - Do anyone has a littl
More>>
Hi,
I am developing a web application in which I convert all the dates into UTC (a unsigned long representing a date) for storing in a database (in the database, the dates are represtned as UTC).
How shall I do this? The major bean provides me with:
[year][month][day][hour][minute][seconds]
The JAVA doc says:
public static long UTC(int year, int month, int date, int hrs, int min, int sec)
Deprecated
. As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date, hrs, min, sec) or GregorianCalendar(year + 1900, month, date, hrs, min, sec), using a UTC TimeZone, followed by Calendar.getTime().getTime()
But I don't get this - Do anyone has a little sample code (a little course :o) ) on how I can convert a date into UTC -
and vis-versa?
One more question I have: How shall in this case handle the TimeZone of a user on the other side of earth? e.g. Shall I store the date as its timezone representation, or shall I store everything a LOCAL time (e.g. GMT 0) then translate it into the right timeZone when needed to be displayed to a given user on a particular part of the world?
Thanks for your help.
<<Less