NSDate conversion
NSDate conversion
- Subject: NSDate conversion
- From: "Ramakrishna Kondapalli" <email@hidden>
- Date: Thu, 18 Mar 2004 09:37:30 +0530
- Thread-topic: NSDate conversion
Hi,
I have an apple double file which contains the finder information
(dates) of the actual file. I have parsed that file to get the created
date. I am getting this value as -1140967947. According to the apple
documentation negative sign represents that the date is after 2000 Jan
1 (In GMT). This value should correspond to 12 Nov 2003.
How can i covert this (-1140967947) to date format? I tried the
following (with -1140967947 and 1140967947)
NSDate* dat = [NSDate dateWithTimeIntervalSince1970:-1140967947];
NSLog(@"1. date is %@",[dat description]);
NSLog(@"2. date is %@",[[NSDate
dateWithTimeIntervalSinceNow:-1140967947] description]);
NSLog(@"3. date is %@",[[NSDate
dateWithTimeIntervalSinceReferenceDate:-1140967947] description]);
NSLog(@"--------------------------------------------------------");
NSDate* dat1 = [NSDate dateWithTimeIntervalSince1970:1140967947];
NSLog(@"4. date is %@",[dat1 description]);
NSLog(@"5. date is %@",[[NSDate
dateWithTimeIntervalSinceNow:1140967947] description]);
NSLog(@"6. date is %@",[[NSDate
dateWithTimeIntervalSinceReferenceDate:1140967947] description]);
Output is:
1. date is 1933-11-05 14:57:33 +0630
2. date is 1968-01-21 17:22:17 +0530
3. date is 1964-11-05 13:57:33 +0530
--------------------------------------------------------
4. date is 2006-02-26 21:02:27 +0530
5. date is 2040-05-14 00:27:11 +0530
6. date is 2037-02-26 21:02:27 +0530
None of the values are nearer to 12 Nov 2003. Why?
--
Thanks
_______________________________________________
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.