How can I obtain the current UNIX timestamp (UNIX timestamp) in different programming languages )?

Source: Internet
Author: User
Java Time
Javascript Math. Round (new date (). gettime ()/1000)
The unit of the value returned by gettime () is millisecond.
Microsoft. NET/C # Epoch = (datetime. Now. touniversaltime (). ticks-621355968000000000)/10000000
MySQL Select unix_timestamp (now ())
Perl Time
PHP Time ()
PostgreSQL Select extract (epoch from now ())
Python Import time first and then time. Time ()
Ruby Obtain UNIX timestamp: time. Now or time. New
Display UNIX timestamp: time. Now. to_ I
SQL Server Select datediff (S, '2017-01-01 00:00:00 ', getutcdate ())
Unix/Linux Date + % s
VBScript/asp Datediff ("S", "01/01/1970 00:00:00", now ())
Other operating systems
(If Perl is installed in the System)
Command Line status: Perl-e "Print time"

Although it is a small function, it is quite useful. You can calculate it yourself, especially for. net.

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.