• 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
Date Formatter fun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Date Formatter fun


  • Subject: Date Formatter fun
  • From: Duncan Campbell <email@hidden>
  • Date: Mon, 14 Feb 2005 13:39:01 +1100

Hey folks - i'm using a dateformatter to get a nice looking datetime:

[today descriptionWithCalendarFormat:@"%a %I:%M %p"]

however, I'm a little annoyed that the "hour" formatter (the %I) always gives the hour as a 2-digit - i.e. 9:45am will be formatted as 09:45am.

This IS as written in the docs, however I was wondering it there was a simple way to get a single-digit hour when appropriate, whilst still being about to use the descriptionWithCalendarFormat method?

My current method - to manually parse the date into day/hour/min/ampm vars - seems like such a lot of code for such a tiny issue...

Anyone any ideas?

Cheers.

---------------------------------------------------------------
Duncan Campbell
http://www.duncanandsarah.com/duncan
---------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Date Formatter fun
      • From: Jeremy Dronfield <email@hidden>
  • Prev by Date: Re: Motion Blur
  • Next by Date: Re: Synchronising views within an enclosing scroll view
  • Previous by thread: Re: Storing images in subfolder of apps resource?
  • Next by thread: Re: Date Formatter fun
  • Index(es):
    • Date
    • Thread