I have the number of micro seconds from the UNIX epoch time 00:00:00 UTC 1
Jan 1970. (1092727073895638 usec)
I want to know the time in CST.
I have been trying to work with the Calendar class and GregorianCalendar.
But I am not quite getting it. Could someone give me an idea of what I need
to do.
Thanks
Ox
Andrew Thompson - 19 Jun 2005 18:51 GMT
> I have the number of micro seconds from the UNIX epoch time 00:00:00 UTC 1
> Jan 1970. (1092727073895638 usec)
> I want to know the time in CST.
What does the 'C' stand for? Central or China (or..)?

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Remi Arntzen - 20 Jun 2005 01:39 GMT
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html#setTime(java.uti
l.Date)
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html#setTimeZone(java
.util.TimeZone)
You shouldn't use CST becuase it can mean either "Central Standard
Time" or "China Standard Time"
RC - 21 Jun 2005 22:12 GMT
> I have the number of micro seconds from the UNIX epoch time 00:00:00 UTC 1
> Jan 1970. (1092727073895638 usec)
[quoted text clipped - 3 lines]
> But I am not quite getting it. Could someone give me an idea of what I need
> to do.
Calendar cal = Calendar.getInstance(
TimeZone.getTimeZone("GMT"), // +00:00
Locale.getDefault());
cal.setTime(new Date((long)1092727073895638));
public String printDate(Calendar cal) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("CST")); // -06:00
// what happen when change to CDT (Central Daylight Time, -05:00) ?
return(sdf.format(cal.getTime()));
}
BTW (By the way) China is CCT (China Coastal Time) +08:00, not CST.