Implementation of time conversion in Oracle in several languages

Source: Internet
Author: User

Conversion of date and time in c shell perl php: seconds and human readable date scalar localtime and seconds since '00: 00: 00 1970-01-01 UTC'
Scalar localtime 26-byte string and seconds since '00: 00: 00 1970-01-01 UTC'
(The number of seconds since, January 1, January 1, 1970)
The number of seconds that have passed since the Epoch: 00:00:00 January 1, 1970, Coordinated Universal Time (UTC ).

C:
Advanced Programming in the UNIX Environment: Second Edition
APUE Seciont 6.10 Figure 6.8. Relationship of the various time functions
# Include <time. h>
Time_t time (time_t * calptr );
Struct tm * localtime (const time_t * calptr );
Struct tm * gmtime (const time_t * calptr );
Time_t mktime (struct tm * tmptr );
Char * asctime (const struct tm * tmptr );
Char * ctime (const time_t * calptr );
Size_t strftime (char * restrict buf, size_t maxsize,
Const char * restrict format,
Const struct tm * restrict tmptr );

Shell:
% Date + % s
1128621784

% Date-d "1970-01-01 UTC 1128621784 seconds"
Fri Oct 7 02:03:04 CST 2005

Date-d "1970-01-01 UTC 1128621784 seconds" + "% Y-% m-% d % H: % M: % S"
2005-10-07 02:03:04

Perl:
% Perl-e 'print scalar localtime 1128621784'
Fri Oct 7 02:03:04 2005

Php:
Date ('Y-m-d H: I: s', time ());

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.