• 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
Re: How to use an NSTimestampFormatter in code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use an NSTimestampFormatter in code


  • Subject: Re: How to use an NSTimestampFormatter in code
  • From: Dev WO <email@hidden>
  • Date: Thu, 27 Oct 2005 17:22:51 +0200

Hi,
I'm actually looking to generate a string containing different "parts", so I have to generate the string in code and bind the method to a WOString in WOBuilder.
But I'm having issue using NSTimestampFormatter directly in code.


Searching for the correct way to use it, I found a post but it doesn't seem to work...

Here's what I have:
public String stringToDisplay() {
NSTimestampFormatter dateTimeFormatter = new NSTimestampFormatter( "%A %e %B %Y", new DateFormatSymbols ( Locale.FRENCH ) );


try {

return item.title() + dateTimeFormatter.parseObject (item.dateAndTime().toString());


Why call parse when you want to format?
I'm not sure I should answer, I already feel stupid;)

return item.title() + dateTimeFormatter.format(item.dateAndTime ());
catch (IllegalArgumentException e) {
return item.title() + "Invalid Date/Time";
}


Thanks Chuck, it works like a charm:)

        }



NSTimestampFormatter inherits from java.text.Format, check the JavaDoc for that class too.
I will, to make sure I won't ask that twice;)

Thanks again:)

Chuck



And it gave me:
Main.java:144: unreported exception java.text.ParseException; must be caught or declared to be thrown


So I know I have to caught/declare the exception, but I'm still figuring how to do it:(

Anyhow I didn't found documentation on how to use NSTimestampFormatter in code...

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


This email sent to email@hidden



--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects







_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >How to use an NSTimestampFormatter in code (From: Dev WO <email@hidden>)
 >Re: How to use an NSTimestampFormatter in code (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: How to use an NSTimestampFormatter in code
  • Next by Date: Re: How to use an NSTimestampFormatter in code
  • Previous by thread: Re: How to use an NSTimestampFormatter in code
  • Next by thread: Re: How to use an NSTimestampFormatter in code
  • Index(es):
    • Date
    • Thread