# Time from 1970 in miliseconds

## Recommended Posts

I need to function that will give me currentTimeMillis() <- java

which is

"the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC."

How can i calculate the different from January 1, 1970 UTC to this moment but in millisecond.. not seconds..

Thank you.

##### Share on other sites

Use _DateDiff() to find this value in seconds and then is piece of cake.

When the words fail... music speaks

##### Share on other sites

Use _DateDiff() to find this value in seconds and then is piece of cake.

Thank you but i need milliseconds not seconds. And multiplying the solution in 1000 is not a option.

##### Share on other sites

Thank you but i need milliseconds not seconds. And multiplying the solution in 1000 is not a option.

Why do you need to know such a long time period to millisecond precision?

This will give you the difference in milliseconds.

Note: depending on the chip set in your PC you may not be able to resolve the time to less than 15 or 16 milliseconds.

```#Include <Date.au3>
\$Millseconds = (_DateDiff("s","1970/01/01 00:00:00",@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) * 1000) + @MSEC
ConsoleWrite('\$Millseconds = ' & \$Millseconds & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console```
Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

##### Share on other sites

Why do you need to know such a long time period to millisecond precision?

This will give you the difference in milliseconds.

Note: depending on the chip set in your PC you may not be able to resolve the time to less than 15 or 16 milliseconds.

```#Include <Date.au3>
\$Millseconds = (_DateDiff("s","1970/01/01 00:00:00",@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) * 1000) + @MSEC
ConsoleWrite('\$Millseconds = ' & \$Millseconds & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console```

Thank you it work

I needed to to send a server data. He need me to wait 60 sec and then to send my system time in milliseconds.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

×

• Wiki

• Back

• Git

## Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.