UTC date
currentmillis

local date

UTC time

local time

UTC millis




local timezone







convert milliseconds


to UTC time and date:



and to local time and date:




Synchronization APIs - this site offers an http request-based web service used in applications that require a reliable 3rd party time provider or that want to avoid / don't have access to a system clock (e.g. use cases related to microcontrollers, games, etc.). Two are essentially a REST API while the other two are Java/Javascript libraries:
Milliseconds since
UNIX epoch
/millis-since-unix-epoch.php Network API
for Javascript
/millis-since-unix-epoch-for-javascript.js
Seconds since
UNIX epoch
/seconds-since-unix-epoch.php Network API
for Java
/CurrentTime.java

convert local YYYY / MM / DD
/ /

and HH / MM / SS

: :

to UTC milliseconds:



Ways To Get The Current Millis - following is a compendium of methods that allow you to get the number of milliseconds passed since the UNIX epoch (January 1st, 1970 UTC) in various programming languages
ActionScript (new Date()).time
C (Unix) #include <sys/time.h> struct timeval tv; gettimeofday(&tv, NULL); millisSinceEpoch = (unsigned long long)(tv.tv_sec) * 1000 + (unsigned long long)(tv.tv_usec) / 1000;
C (Windows) #include "windows.h" SYSTEMTIME time; GetSystemTime(&time); WORD millis = (time.wSecond * 1000) + time.wMilliseconds;
C#.NET (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalMilliseconds
Clojure (System/currentTimeMillis)
Java System.currentTimeMillis()
Javascript new Date().getTime()
MySQL* UNIX_TIMESTAMP() * 1000
Objective-C (long long)([[NSDate date] timeIntervalSince1970] * 1000.0)
Oracle PL/SQL* SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) * 24 * 60 * 60 * 1000 FROM DUAL
Perl use Time::HiRes qw(gettimeofday); print gettimeofday;
PHP round(microtime(true) * 1000)
PostgreSQL extract(epoch FROM now()) * 1000
Python int(round(time.time() * 1000))
Ruby (Time.now.to_i).floor
Scala val timestamp: Long = System.currentTimeMillis
SQL Server DATEDIFF(ms, '1970-01-01 00:00:00', GETUTCDATE())
VBScript* DateDiff("s", "01/01/1970 00:00:00", Now()) * 1000

*might not reach millisecond accuracy but is multiplied to reach millisecond range



Science & Trivia - here you have some scientific facts as well as controversies surrounding time keeping
Abbreviation Millis is the popular abbreviation for milliseconds. The formal one would be ms. Another one would be millisecs but this is very rare
Leap seconds Leap seconds are one-second adjustments added to the UTC time to synchronize it with solar time. Leap seconds tend to cause trouble with software. For example, on June 30, 2012 you had the time 23:59:60. Google uses a technique called leap smear on its servers, which, instead of adding an extra second, extend seconds prior to the end of the day by a few milliseconds each so that the day will last 1000 milliseconds longer.
Theory of Relativity The Special and General theories of Relativity are taken into account by GPS receivers (found in planes, cars and mobile phones) and Earth-orbiting satellites to synchronize their time within a 20-30 nanosecond range. This happens because satellites are in motion relative to the planet so the observers on the planet will perceive time is passing more slowly for the satellites.
UTC vs. GMT
(simple take)
UTC stands for Coordinated Universal Time. GMT stands for Greenwich Mean Time. UTC is a universal time keeping standard by itself. A time expressed in UTC is essentially the time on the whole planet. A time expressed in GMT is the time in the timezone of the Greenwich meridian. In current computer science problems (and probably most scientific ones) UTC and GMT expressed in absolute value happen to have identical values so they have been used interchangeably.
UTC vs. GMT
(complex take)
Literature and history here are a bit ambiguous. So i’ll write a personal and subjective (but educated) assessment: UTC essentially appeared in 1960, GMT being the ‘main thing’ until then. Unlike GMT which is based on solar time and originally calculated a second as a fraction of the time it takes for the Earth to make a full rotation around its axis, UTC calculates a second as “the duration of 9192631770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the cesium 133 atom”. UTC’s second is far more precise than GMT's original second. In 1972 leap seconds were introduced to synchronize UTC time with solar time. These 2 turning points (different definition of a second and the introduction of leap seconds) ‘forced’ GMT to be the same as UTC based on what seemed a gradual, tacit convention. If you were to calculate true GMT today i would see it based on its original definition of 1 second = 1/86400 days and this would for sure return a different absolute value than what UTC gives us today. From this point of view the name “GMT” seems deprecated, but kept around for backward compatibility, traditional timezone based representation of time and sometimes legal reasons.
UTC vs. UT1 UT1 is the most precise form of universal time. It's computed using observations of quasars in outer space (which make up the International Celestial Reference Frame) and of distances between Earth and its satellites - natural (Moon) and artificial. UTC only tries to approximate UT1: it is kept within 0.9 seconds of UT1 by employing leap seconds.


Engineering - One programming challenge is how to keep timestamps in an ascending order in the database during leap seconds. Below is a pseudocode solution involving a technique similar to the 'smear':

if (newTime is in a leap second){
  read smearCount from db;
  if (smearCount <= 0) {
    smearCount = 1000; // making sure we land outside the leap second
    update smearCount in db;
  }
  newTime += smearCount;
  insert newTime into db;
} else { // gradually reducing smearCount by 1 millisecond over the following 1000 insertions
  read smearCount from db;
  if (smearCount > 0){
    smearCount -= 1;
    update smearCount in db;
    newTime += smearCount;
  }
  insert newTime into db;
}


The Current Millis Story - This site is an online check of the current UTC time in milliseconds elapsed since the UNIX epoch (Jan 1st, 1970), along with some local time - UTC comparisons. You can also convert milliseconds to date and time and the other way around.

The "current millis" story started with me debugging my Sand application for Android. In Android you tell an alarm when to come up by passing a simple number. This number has to be so large that it can encompass all the time passed since midnight January 1st, 1970 but sufficiently small that it can fit into existing data structures and keep going for a sufficient time in the future. Precision: millisecond. Why 1970 you ask? It is just a convention: it was the roundest most recent year to the point in time people actually started thinking about a universal measure of time.

As i was debugging i needed something to tell me what the current time in millis is. Since a program was already running, rather than just inspecting Java's System.currentTimeMillis() or running a program that shows it to me, i figured i'll open a web page that shows it. There was nothing like it in the search results. The funniest result i saw was telling me the local time in Millis, Massachusetts. I could not believe there isn't a site that does such a simple thing. I wrote currentmillis.com and hit enter. My ISP's page popped up telling me there is no such page. I then went to GoDaddy which told me this incredibly simple domain was available. So i bought it and turned it into a single-serving website which shows, you guessed it, the current time in millis.

In my opinion this is the most reasonably precise measuring standard ever. And timing isn't the easiest problem to solve, especially in a world where GPS has to take into account Einstein's theory of relativity and leap seconds have to be added from time to time to keep UTC (Coordinated Universal Time) in sync with solar time. The irony is i probably would have never found out that the last second of June 30, 2012 was 23:59:60 if i wouldn't have bought currentmillis.com.

My goal for this website is that programmers all around the world know: when you want to see the current UTC time in millis you can do so easily at currentmillis.com. If you spot a mistake or you want to suggest a new feature, you can send me an email here.