Queries on Date Problems
Queries on Date Problems
- Subject: Queries on Date Problems
- From: "Prashanth Rao" <email@hidden>
- Date: Tue, 19 Nov 2002 19:45:39 +0530
Hi,
In our application, all the dates are needed to be displayed as per date
format setting in the International panel of System Preferences. We are
facing two issues with regards to this.
1st Issue:
We are using [[NSUserDefaults standardUserDefaults]
stringForKey:NSShortDateFormatString] to get the date format.
This does not always return us the correct format.
1. I created a new user account on my Mac machine.
2. Logged in as this user.
3. Launched the application.
4. The date displayed is in DD MON YYYY format ( space as separator ) even
though in the International setting, the date format is MM/DD/YYYY (
Default US Region ).
5. I then go and touch the Region or anything in the Date Panel of
International settings and relaunch the application, the date format is
taken up correctly.
Is there any solution to this problem ?
2nd Issue:
The NSDateFormatter validates only the Date Format but not the actual date.
We use the following
NSDateFormatter *f = [[NSDateFormatter alloc]
initWithDateFormat:kDateFormat allowNaturalLanguage:NO];
// kDateFormat is the System Date Format. Eg. MM/DD/YYYY
[f getObjectValue:&obj forString:dateString errorDescription:&error]; //
dateString - Input date from user Eg. 33/33/2002
Here only the Format gets validated and not the actual date as such.
The output displayed is 04/23/2095
Is there any method which validates the Date too ?
Cheers,
Prashanth.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.