This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Date Format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date Format" Watch "Date Format" New topic
Author

Date Format

Lim Youjie
Greenhorn

Joined: Dec 27, 2004
Posts: 22
Hi,

may i know how to change the date format to CST of the Date object?

thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
The Date class has no concept of timezones. You will need to use the Calendar class.


Ping & DNS - my free Android networking tools app
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
If you require a Timezone aware date implementation you might want to evaluate:

Joda Time

Regards, Guy
Joni Salonen
Ranch Hand

Joined: Jan 07, 2006
Posts: 53
You can set the time zone of a DateFormat object by using the setTimeZone method: http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html
For example:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Format