Units are seconds since 1970., unitsseconds
In the actual development process of Android, we often encounter a date in seconds. In this case, we can format them as needed. The specific steps are as follows:
LongSeconds = Long.ParseLong("1405889699580 ");
Date date =NewDate (seconds );
SimpleDateFormatsdf =NewSimpleDateFormat ("MM mm dd, yyyy hh MM ss seconds ");
String time = sdf. format (date ));
Conversion Result: time:, January 1, July 20, 2014
Application scenarios:
When obtaining Android media file date, short message date, and other information, the returned time is the Units are seconds time. This is the format in which we can format the seconds into years, months, days, minutes, and seconds.
Help ''''''
You do not need to reinvent the wheel. Please find the source code of this program.
$ Date -- help
Usage: date [OPTION]... [+ FORMAT]
Or: date [-u | -- utc | -- universal] [MMDDhhmm [[CC] YY] [. ss]
Display the current time in the given FORMAT, or set the system date.
-D, -- date = STRING display time described by STRING, not 'now'
-F, -- file = DATEFILE like -- date once for each line of DATEFILE
-R, -- reference = FILE display the last modification time of FILE
-R, -- rfc-2822 output date and time in RFC 2822 format.
Example: Mon, 07 Aug 2006 12:34:56-0600
-- Rfc-3339 = TIMESPEC output date and time in RFC 3339 format.
TIMESPEC = 'date', 'seconds', or 'ns'
Date and time to the indicated precision.
Date and time components are separated
A single space: 12:34:56-
-S, -- set = STRING set time described by STRING
-U, -- utc, -- universal print or set Coordinated Universal Time
-- Help display this help and exit
-- Version output version information and exit
FORMAT controls the output. The only valid option for the second form
Specifies Coordinated Universal Time. Interpreted sequences are:
% A literal %
% A locale's abbreviated weekday name (e.g., Sun)
% A locale's full weekday name (e.g., Sunday)
% B locale's abbreviated month name (e.g., Jan)
% B locale's full month name (... the remaining full text>
Since the 1970 s limit new applications have been found for me
Many new applications found for me in the 1970 s