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
Now1624032066
1 hour ago1624028466
2 hours ago1624024866
3 hours ago1624021266
6 hours ago1624010466
12 hours ago1623988866
1 day ago1623945666
2 days ago1623859266
3 days ago1623772866
1 week ago1623427266
2 weeks ago1622822466
3 weeks ago1622217666
4 weeks ago1621612866
1 month ago1621353666
2 months ago1618761666
3 months ago1616083266
6 months ago1608307266
9 months ago1600444866
1 year ago1592496066
2 years ago1560873666
3 years ago1529337666
5 years ago1466265666
10 years ago1308412866

Upcoming dates

Date Unix timestamp
Now1624032066
In 1 hour1624035666
In 2 hours1624039266
In 3 hours1624042866
In 6 hours1624053666
In 12 hours1624075266
In 1 day1624118466
In 2 days1624204866
In 3 days1624291266
In 1 week1624636866
In 2 weeks1625241666
In 3 weeks1625846466
In 4 weeks1626451266
In 1 month1626624066
In 2 months1629302466
In 3 months1631980866
In 6 months1639843266
In 9 months1647619266
In 1 year1655568066
In 2 years1687104066
In 3 years1718726466
In 5 years1781798466
In 10 years1939564866

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-06-18 16:01:06.164

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 1624032066

#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 18 Jun 16:01:06 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

1624032066

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-06-18 16:01:06'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1624032066);

Output

2021-06-18 16:01:06
TOP