Ios-nsdateformatter Format description: NSDateFormatter

G: AD, for example AD

Yy: In the last two years

Yyyy: full years

MM: month. The value is 1-12

MMM: month, for example, Jan

MMMM: indicates the full name of a month, such as Janualy

Dd: a 2-digit number, such as 02

D: day, 1-2 digit display, such as 2

EEE: short for the day of the week, as in Sun

EEEE: Write all the days of the week, such as Sunday

Aa: Morning and afternoon, AM/PM

H: Hour, 24-hour system, 0-23

K: Hour, 12-hour system, 0-11

M: One or two

Mm: Two digits

S: Second, 1-2 bits

Ss: Second, two bits

S: ms

Common date structure:

yyyy-MM-dd HH:mm:ss.SSS

yyyy-MM-dd HH:mm:ss

yyyy-MM-dd

MM dd yyyy

1. Get for example: December 12, 2014 Sunday 12:00 PM date





FIG. 1

NSDateFormatter = NSDateFormatter = NSDateFormatter;

2. The timestamp





Passing in the date string





The number of timestamp seconds passed in





Seconds to date character string

Utility class git address: https://github.com/C100515C/NSDateTool.git