Top community members
All Wiki Articles Create Wiki Article

Many years me and my friends we were volunteers on my university doing programming classes for young people.

I got main conclusion: Young people are awesome, especially students, because they always bring new and fresh ideas :)
* I loved to do it but my time is limited

  I decided to create something that will help millions of students

Now I am here

co-founder

Linux / Bash - print current Unix time in milliseconds

0 contributions
1 points

In this short article we would like to show how to print unix time in millisecondsĀ in Unix / Linux terminal.

Quick example:

date +%s%3N

Screenshot:Ā 

millisecond time in Linux / Unix
millisecond time in Linux / Unix

or

date +%s%N | cut -b 1-13

# or

echo $(($(date +%s%N) / 1000000))

Some linux distributions and Unix based operating systems like OS X could do not upport %N, so it can be necessary to use other solution to get it. Below description shows how to do it with different techniques.

Solutions table:Ā 

LanguageConsole command
Rubyruby -e 'puts Time.now.to_f'
Pythonpython -c 'import time; print time.time()'
Node.jsnode -e 'console.log(Date.now())'
PHPphp -r 'echo microtime(TRUE);'
ElixirDateTime.utc_now() |> DateTime.to_unix(:millisecond)
wget + internetuse wget to download time
curl + linkuse curl to download time
date roundeddate +%s000

Example time source for wget and curl:

  1. https://currentmillis.com/
0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey šŸ‘‹
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more