Re: Date to string
Re: Date to string
- Subject: Re: Date to string
- From: j o a r <email@hidden>
- Date: Mon, 28 Nov 2005 10:57:20 +0100
On 28 nov 2005, at 07.17, JuanC wrote:
The matter is that I need put a static text with the date of today
in a window.
The best way sould be with the european format: DD-MM-YY (28 Nov.
2005).
I donĀ“t know what is the best way: NSDate or NSCalendar... for get
the date and NSText or NSTextView... for draw the string.
Something like this (probably full of bugs, I typed it in Mail):
NSCalendarDate *calendarDate = [NSCalendarDate calendarDate];
[myTextField setStringValue: [calendarDate
descriptionWithCalendarFormat: @"%d-%m-%Y"]];
On 28 nov 2005, at 10.04, Uli Kusterer wrote:
ISO dates are also the closest you can get to a "European" date
(and are used in Sweden).
Wohoo! We're the greatest!
I think you can also use an NSDateFormatter with an NSTextField.
Though formatters are mostly valuable for controlling user input,
right? Well, at least on versions of Mac OS X prior to 10.4. It seems
to have changed a lot recently:
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSDateFormatter_index.html>
If you want to output a date in a format that is appropriate for the
current locale, it seems that NSDateFormatter is the way to go. If
you, on the other hand, just want to use a specific date format
string, you can use the simple way I outlined above.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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