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
Now1611688875
1 hour ago1611685275
2 hours ago1611681675
3 hours ago1611678075
6 hours ago1611667275
12 hours ago1611645675
1 day ago1611602475
2 days ago1611516075
3 days ago1611429675
1 week ago1611084075
2 weeks ago1610479275
3 weeks ago1609874475
4 weeks ago1609269675
1 month ago1609010475
2 months ago1606418475
3 months ago1603740075
6 months ago1595791275
9 months ago1587928875
1 year ago1580066475
2 years ago1548530475
3 years ago1516994475
5 years ago1453836075
10 years ago1296069675

Upcoming dates

Date Unix timestamp
Now1611688875
In 1 hour1611692475
In 2 hours1611696075
In 3 hours1611699675
In 6 hours1611710475
In 12 hours1611732075
In 1 day1611775275
In 2 days1611861675
In 3 days1611948075
In 1 week1612293675
In 2 weeks1612898475
In 3 weeks1613503275
In 4 weeks1614108075
In 1 month1614367275
In 2 months1616786475
In 3 months1619464875
In 6 months1627327275
In 9 months1635276075
In 1 year1643224875
In 2 years1674760875
In 3 years1706296875
In 5 years1769455275
In 10 years1927221675

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-01-26 19:21:15.646

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 1611688875

#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: Tue 26 Jan 19:21:15 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

1611688875

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-01-26 19:21:15'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1611688875);

Output

2021-01-26 19:21:15
TOP