Current Date & Time in Objective C
In this tutorial , i will tell you about NSDate and NSDateFormatters .
NSDate is inbuilt Objective c function which is used to find current date and time .
NSDateFormatter is used to format the date and time .eg :- MM/DD/YYYY hh:mm:ss.
Code is explained in comments.
Other date formats are as follows :
Date Formats Examples
M/d/y | 23/7/1993 |
MM/dd/yy | 23/07/93 |
MMM d, ''yy | Nov 4, '12 |
MMMM | November |
E | Sun |
EEEE | Sunday |
'Week' w 'of 52' | Week 45 of 52 |
'Day' D 'of 365' | Day 309 of 365 |
QQQ | Q4 |
QQQQ | 4th quarter |
m 'minutes past' h | 9 minutes past 8 |
h:mm a | 8:09 PM |
HH:mm:ss's' | 20:09:00s |
HH:mm:ss:SS | 20:09:00:00 |
h:mm a zz | 8:09 PM C |
h:mm a zzzz | 8:09 PM Central Standard Time |
yyyy-MM-dd HH:mm:ss Z | 2012-11-04 20:09:00 -0600 |
Thank You :)
Comments
Post a Comment