Units are seconds since 1970., unitsseconds

Source: Internet
Author: User
Tags month name

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.