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
Now1656973189
1 hour ago1656969589
2 hours ago1656965989
3 hours ago1656962389
6 hours ago1656951589
12 hours ago1656929989
1 day ago1656886789
2 days ago1656800389
3 days ago1656713989
1 week ago1656368389
2 weeks ago1655763589
3 weeks ago1655158789
4 weeks ago1654553989
1 month ago1654381189
2 months ago1651702789
3 months ago1649110789
6 months ago1641334789
9 months ago1633385989
1 year ago1625437189
2 years ago1593901189
3 years ago1562278789
5 years ago1499206789
10 years ago1341440389

Upcoming dates

Date Unix timestamp
Now1656973189
In 1 hour1656976789
In 2 hours1656980389
In 3 hours1656983989
In 6 hours1656994789
In 12 hours1657016389
In 1 day1657059589
In 2 days1657145989
In 3 days1657232389
In 1 week1657577989
In 2 weeks1658182789
In 3 weeks1658787589
In 4 weeks1659392389
In 1 month1659651589
In 2 months1662329989
In 3 months1664921989
In 6 months1672870789
In 9 months1680646789
In 1 year1688509189
In 2 years1720131589
In 3 years1751667589
In 5 years1814739589
In 10 years1972592389

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

2022-07-04 22:19:49.196

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 1656973189

#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: Mon 04 Jul 22:19:49 2022

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

1656973189

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('2022-07-04 22:19:49'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1656973189);

Output

2022-07-04 22:19:49
TOP