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
Now1664269506
1 hour ago1664265906
2 hours ago1664262306
3 hours ago1664258706
6 hours ago1664247906
12 hours ago1664226306
1 day ago1664183106
2 days ago1664096706
3 days ago1664010306
1 week ago1663664706
2 weeks ago1663059906
3 weeks ago1662455106
4 weeks ago1661850306
1 month ago1661591106
2 months ago1658912706
3 months ago1656320706
6 months ago1648371906
9 months ago1640595906
1 year ago1632733506
2 years ago1601197506
3 years ago1569575106
5 years ago1506503106
10 years ago1348736706

Upcoming dates

Date Unix timestamp
Now1664269506
In 1 hour1664273106
In 2 hours1664276706
In 3 hours1664280306
In 6 hours1664291106
In 12 hours1664312706
In 1 day1664355906
In 2 days1664442306
In 3 days1664528706
In 1 week1664874306
In 2 weeks1665479106
In 3 weeks1666083906
In 4 weeks1666688706
In 1 month1666861506
In 2 months1669539906
In 3 months1672131906
In 6 months1679907906
In 9 months1687856706
In 1 year1695805506
In 2 years1727427906
In 3 years1758963906
In 5 years1822035906
In 10 years1979888706

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-09-27 09:05:06.522

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 1664269506

#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 27 Sep 09:05:06 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

1664269506

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-09-27 09:05:06'))

Option 2

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

Option 3

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

SELECT FROM_UNIXTIME(1664269506);

Output

2022-09-27 09:05:06
TOP