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
Now1632291031
1 hour ago1632287431
2 hours ago1632283831
3 hours ago1632280231
6 hours ago1632269431
12 hours ago1632247831
1 day ago1632204631
2 days ago1632118231
3 days ago1632031831
1 week ago1631686231
2 weeks ago1631081431
3 weeks ago1630476631
4 weeks ago1629871831
1 month ago1629612631
2 months ago1626934231
3 months ago1624342231
6 months ago1616393431
9 months ago1608617431
1 year ago1600755031
2 years ago1569132631
3 years ago1537596631
5 years ago1474524631
10 years ago1316671831

Upcoming dates

Date Unix timestamp
Now1632291031
In 1 hour1632294631
In 2 hours1632298231
In 3 hours1632301831
In 6 hours1632312631
In 12 hours1632334231
In 1 day1632377431
In 2 days1632463831
In 3 days1632550231
In 1 week1632895831
In 2 weeks1633500631
In 3 weeks1634105431
In 4 weeks1634710231
In 1 month1634883031
In 2 months1637561431
In 3 months1640153431
In 6 months1647929431
In 9 months1655878231
In 1 year1663827031
In 2 years1695363031
In 3 years1726985431
In 5 years1790057431
In 10 years1947823831

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-09-22 06:10:31.533

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 1632291031

#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: Wed 22 Sep 06:10:31 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

1632291031

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-09-22 06:10:31'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1632291031);

Output

2021-09-22 06:10:31
TOP