Hi all,
i m creating a file that contains date time and current locale,
and after creating the file when application start read the file and calculate the time difference from file time to currently running time.
now i want to write only date value in file and calculate the days difference from file date to current date.
please help me how can i do this.
thanks in advance.
i m creating a file that contains date time and current locale,
and after creating the file when application start read the file and calculate the time difference from file time to currently running time.
Code:
//Install Date/Time Reference File
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *installDateFile = @"~/Desktop/setlDateFile.txt";
installDateFile = [installDateFile stringByExpandingTildeInPath];
if ([fileManager fileExistsAtPath: installDateFile] == NO)
{
NSString *installDate = [[NSDate date] descriptionWithCalendarFormat:nil timeZone:nil locale:nil];
[installDate writeToFile:installDateFile atomically:YES encoding:NSUnicodeStringEncoding error:NULL];
}
double secondsUsed = [[NSDate date] timeIntervalSinceDate:[NSDate dateWithString:[NSString stringWithContentsOfFile:[@"~/Desktop/setlDateFile.txt" stringByExpandingTildeInPath]]]];
now i want to write only date value in file and calculate the days difference from file date to current date.
please help me how can i do this.
thanks in advance.