current location:PHP Chinese website download site>Online toolbox> Unix timestamp conversion tool
Unix timestamp conversion tool

Unix timestamp conversion tool

Online Unix timestamp conversion tool

The current Unix timestamp is:1484289773

Unix timestamp (Unix timestamp) → Beijing time (refresh the page to copy the timestamp of the current time into the input box below)


Beijing time → Unix timestamp (Unix timestamp)

Beijing time Year moon day hour point Second

What is a timestamp?

Unix timestamp (Unix timestamp), also known as Unix time (Unix time), POSIX time (POSIX time), is a time representation method, defined as starting from 00:00 Greenwich Mean Time on January 1, 1970 The total number of seconds since minute 00 seconds. Unix timestamps are not only used in Unix systems and Unix-like systems, but are also widely used in many other operating systems. Most Unix systems store the timestamp as a 32-bit integer, which may cause some problems on January 19, 2038 (Y2038 problem).

How to get the current Unix timestamp (Unix timestamp) in different programming languages?

#
Java time
JavaScript Math.round(new Date().getTime()/1000)
The unit of the value returned by getTime() is milliseconds
Microsoft .NET/Cepoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
MySQL SELECT unix_timestamp(now())
Perl time
PHP time()
PostgreSQL SELECT extract(epoch FROM now())
Python Firstimport timeThentime.time()
Ruby Get Unix timestamp:Time.noworTime.new
Display Unix timestamp:Time.now.to_i
SQL Server SELECT DATEDIFF(s, '1970-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 on the system)
Command line status:perl -e "print time"

How to implement Unix timestamp (Unix timestamp) → ordinary time in different programming languages?

Java String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(Unix timestamp* 1000))
JavaScript Firstvar unixTimestamp = new Date(Unix timestamp* 1000)ThencommonTime = unixTimestamp.toLocaleString()
Linux date -d @Unix timestamp
MySQL from_unixtime(Unix timestamp)
Perl Firstmy $time =Unix timestampThenmy ($sec, $min, $hour, $day, $month, $year) = (localtime($time))[0,1,2,3,4,5,6]
PHP date('r',Unix timestamp)
PostgreSQL SELECT TIMESTAMP WITH TIME ZONE 'epoch'Unix timestamp) * INTERVAL '1 second';
Python Firstimport timeThentime.gmtime(Unix timestamp)
Ruby Time.at(Unix timestamp)
SQL Server DATEADD(s,Unix timestamp, '1970-01-01 00:00:00')
VBScript / ASP DateAdd("s",Unix timestamp, "01/01/1970 00:00:00")
Other operating systems
(if Perl is installed on the system)
Command line status:perl -e "print scalar(localtime(Unix timestamp))"

How to implement ordinary time → Unix timestamp (Unix timestamp) in different programming languages?

Java long epoch = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");
JavaScript var commonTime = new Date(Date.UTC(year,month- 1,day,hour,minute,second))
MySQL SELECT unix_timestamp(time)
Time format: YYYY-MM-DD HH:MM:SS or YYMMDD or YYYYMMDD
Perl Firstuse Time::LocalThenmy $time = timelocal($sec, $min, $hour, $day, $month, $year);
PHP mktime(hour,minute,second,month,day,year)
PostgreSQL SELECT extract(epoch FROM date('YYYY-MM-DD HH:MM:SS'));
Python Firstimport timeThenint(time.mktime(time.strptime('YYYY-MM-DD HH:MM:SS', '% Y-%m-%d %H:%M:%S')))
Ruby Time.local(year,month,day,hour,minute,second)
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00',time)
Unix / Linux date %s -d"Jan 1, 1970 00:00:01"
VBScript / ASP DateDiff("s", "01/01/1970 00:00:00",time)
Web comments
Latest comments