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
Now1643253898
1 hour ago1643250298
2 hours ago1643246698
3 hours ago1643243098
6 hours ago1643232298
12 hours ago1643210698
1 day ago1643167498
2 days ago1643081098
3 days ago1642994698
1 week ago1642649098
2 weeks ago1642044298
3 weeks ago1641439498
4 weeks ago1640834698
1 month ago1640575498
2 months ago1637983498
3 months ago1635305098
6 months ago1627356298
9 months ago1619493898
1 year ago1611717898
2 years ago1580095498
3 years ago1548559498
5 years ago1485487498
10 years ago1327634698

Upcoming dates

Date Unix timestamp
Now1643253898
In 1 hour1643257498
In 2 hours1643261098
In 3 hours1643264698
In 6 hours1643275498
In 12 hours1643297098
In 1 day1643340298
In 2 days1643426698
In 3 days1643513098
In 1 week1643858698
In 2 weeks1644463498
In 3 weeks1645068298
In 4 weeks1645673098
In 1 month1645932298
In 2 months1648351498
In 3 months1651029898
In 6 months1658892298
In 9 months1666841098
In 1 year1674789898
In 2 years1706325898
In 3 years1737948298
In 5 years1801020298
In 10 years1958786698

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-01-27 03:24:58.036

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 1643253898

#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: Thu 27 Jan 03:24:58 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

1643253898

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-01-27 03:24:58'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1643253898);

Output

2022-01-27 03:24:58
TOP