Current Timestamp

This page show the current Unix timestamp

Current Timestamp

Current timestamp is also known as Unix timestamp, Unix time, and Unix epoch. It tells the number of seconds that have been elapsed since January 1, 1970 (midnight UTC/GMT). It doesn’t count leap seconds.

Unix time stamp in: C++, JAVA, Python, PHP, Javascript, MySQL, Unix time on Wikipedia.org


Recent dates

Date Unix timestamp
Now1618543659
1 hour ago1618540059
2 hours ago1618536459
3 hours ago1618532859
6 hours ago1618522059
12 hours ago1618500459
1 day ago1618457259
2 days ago1618370859
3 days ago1618284459
1 week ago1617938859
2 weeks ago1617334059
3 weeks ago1616729259
4 weeks ago1616124459
1 month ago1615865259
2 months ago1613446059
3 months ago1610767659
6 months ago1602818859
9 months ago1594870059
1 year ago1587007659
2 years ago1555385259
3 years ago1523849259
5 years ago1460777259
10 years ago1302924459

Upcoming dates

Date Unix timestamp
Now1618543659
In 1 hour1618547259
In 2 hours1618550859
In 3 hours1618554459
In 6 hours1618565259
In 12 hours1618586859
In 1 day1618630059
In 2 days1618716459
In 3 days1618802859
In 1 week1619148459
In 2 weeks1619753259
In 3 weeks1620358059
In 4 weeks1620962859
In 1 month1621135659
In 2 months1623814059
In 3 months1626406059
In 6 months1634354859
In 9 months1642303659
In 1 year1650079659
In 2 years1681615659
In 3 years1713238059
In 5 years1776310059
In 10 years1934076459

How to get current timestamp in Java

Here is an example how you can get current timestamp in Java

import java.sql.Timestamp; import java.util.Date; public class CurrentTimeStamp { public static void main( String[] args ) { java.util.Date date= new java.util.Date(); System.out.println(new Timestamp(date.getTime())); } }

Output

2021-04-16 03:27:39.260

How to get current timestamp in C++

Here is an example how you can get current timestamp in C++

#include <stdio.h> #include <time.h> int main() { time_t now; now = time(NULL); printf("Current unix time is %d", now); return 0; }

execution

Current unix time is 1618543659

#include <stdio.h> #include <time.h> int main () { time_t rawtime; struct tm * timeinfo; time (&rawtime); timeinfo = localtime (&rawtime); printf ("Current local time and date: %s", asctime(timeinfo)); return 0; }

execution

Current local time and date: Fri 16 Apr 03:27:39 2021

How to get current timestamp in Python

Here is an example how you can get current timestamp in Python

import time import datetime print "Current unix time: %s" %time.time() print "Current date and time: " , datetime.datetime.now()

Output

Current unix time: 1409073472.17 Current date and time: 2014-08-26 12:17:52.165704

How to get current timestamp in PHP

Here is an example how you can get current timestamp in PHP

<?php echo time(); ?>

Output

1618543659

How to get current timestamp in Javascript

Here is an example how you can get current timestamp in Javascript

var timestamp = new Date().getTime(); document.write(timestamp);

Output

How to get current timestamp in MySQL

Here is an example how you can get current timestamp in MySQL

CREATE TABLE `mytable` ( `id` int(11) NOT NULL, `text` varchar(100) NOT NULL, `epoch` int(11) NOT NULL );

Option 1

INSERT INTO mytable VALUES(1,'hello',UNIX_TIMESTAMP('2021-04-16 03:27:39'))

Option 2

INSERT INTO mytable VALUES(1,'hello',UNIX_TIMESTAMP('1618543659'))

Option 3

INSERT INTO mytable VALUES(1,'hello',UNIX_TIMESTAMP(now()))

SELECT FROM_UNIXTIME(1618543659);

Output

2021-04-16 03:27:39
TOP