• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Calendar time formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calendar time formatting


  • Subject: Calendar time formatting
  • From: Simon Wright <email@hidden>
  • Date: Sat, 29 Sep 2001 11:06:18 -0400

Friends:

I'm using this...

myTime.get(Calendar.HOUR_OF_DAY)+":"+myTime.get(Calendar.MINUTE)+":"+myTime.
get(Calendar.SECOND);

to make a string that represents the time. When the hour or minute or second is less than 10, I'm getting...

1:2:3

When I'd like to get...

01:02:03

How can I achieve this? Or is there some Calendar call that I'm overlooking that will give me the string preassembled?

Same question applies to dates, although there's probably some mechanism I should use that applies the proper internationalization to the date string.

TIA.

Simon


  • Prev by Date: OT: IrDA in 5G64
  • Next by Date: Re: psnup replacement?
  • Previous by thread: OT: IrDA in 5G64
  • Next by thread: Project builder 1.0.1 doesn't work with OSX 10.1 upgrade
  • Index(es):
    • Date
    • Thread