iOS Dev: Create Timestamp in Objective-C

Timestamp : A timestamp is a sequence of characters, denoting the date or time at which a certain event occurred.
In Objective C and iOS development, some times you create a timestamp (Unix Time Stamp Style) , use like this :
=======================Objective – C Code =====================
NSString * timeStampValue = [NSString stringWithFormat:@”%d”, (long)[[NSDate date] timeIntervalSince1970]];
NSLog(@”Time Stamp Value == %@”, timeStampValue);

Output: 1334320615

Some definitions which are useful to you:
SQL Definition: The term “TIMESTAMP” is a datatype which create the unique number by using automatic process. The created number will be databse-wise unique.
In SQL “GETDATE() function” which is built-in is used display the current date and time in “timestamp” form.
For Example:
USE database_demo;
select GETDATE();

Output: 2009-11-30 11-34-21.940

What is the unix time stamp?
The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.

What happens on January 19, 2038?
On this date the Unix Time Stamp will cease to work due to a 32-bit overflow. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems which will buy the time stamp a “bit” more time.



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s