A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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
It is sorta covered in the
JavaRanch Style Guide
subject: How to format a date.
Date Function - HOLIDAY
Calendar returns wrong date?
How to read a file
Calender class and its components
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013