A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Customer Requirements for Developers
this week in the
How to format a date.
Joined: Sep 10, 2001
Aug 08, 2005 09:30:00
I have a Date object.
I want to print the date like this:
Calendar c = Calendar.getInstance();
c.setTime(shipDate1); //shipDate is my Date Objecy
date = String.valueOf(c.get(Calendar.YEAR)) + String.valueOf(c.get(Calendar.DAY_OF_MONTH)) +
The 0's from the day and month keep getting trimmed. There has to be a clean way to do this.
Joined: May 20, 2005
Aug 08, 2005 09:45:00
There is a clean way to do this.
Take a look at
-Rich, SCJP 1.4
I agree. Here's the link:
subject: How to format a date.
Calender class and its components
How to read a file
Calendar returns wrong date?
Date Function - HOLIDAY
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015