A millisecond is a thousandth (1/1,000) of a second.
Questions tagged [milliseconds]
660 questions
61
votes
3 answers
ffmpeg video editing command in milliseconds timestamp
I am editing a video with ffmpeg where I have to keep in view the timestamp further deep from seconds to milliseconds. I know such command : ffmpeg -i a.ogg -ss 00:01:02 -to 00:01:03 -c copy x2.ogg. This uses seconds, but I want down to…

Harjit Singh
- 905
- 1
- 8
- 17
58
votes
9 answers
How to measure the a time-span in seconds using System.currentTimeMillis()?
How to convert System.currentTimeMillis(); to seconds?
long start6=System.currentTimeMillis();
System.out.println(counter.countPrimes(100000000)+" for "+start6);
The console shows me 5761455 for 1307816001290.
I can't read how many seconds that…

J13t0u
- 811
- 1
- 8
- 19
55
votes
4 answers
Get current time in milliseconds using C++ and Boost
In my thread (using boost::thread) I need to retrieve the current time in ms or less and to convert into ms:
Actually, reading here I've found this:
tick = boost::posix_time::second_clock::local_time();
now =…

ghiboz
- 7,863
- 21
- 85
- 131
54
votes
5 answers
new Date(milliseconds) returns Invalid date
I am trying to convert milliseconds to a date using the javascript using:
new Date(Milliseconds);
constructor, but when I give it a milliseconds value of say 1372439683000 it returns invalid date. If I go to a site that converts milliseconds to…

user1634451
- 5,133
- 6
- 30
- 43
37
votes
1 answer
H2 database string to timestamp
Insertion of timestamps in H2 database
Hello, I have to insert data like '17-09-2012 18:47:52.69'. Function PARSEDATETIME cuts milliseconds.
Query example:
CREATE TABLE TEST(ID NUMBER(19) not null,
DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
INSERT…

shprotova
- 535
- 1
- 5
- 8
36
votes
4 answers
Conversion of nanoseconds to milliseconds and nanoseconds < 999999 in Java
I'm wondering what the most accurate way of converting a big nanoseconds value is to milliseconds and nanoseconds, with an upper limit on the nanoseconds of 999999. The goal is to combine the nanoseconds and milliseconds values to ensure the maximum…

Chris Dennett
- 22,412
- 8
- 58
- 84
36
votes
6 answers
Get milliseconds until midnight
I'm creating an Android widget that I want to update every night at midnight. I am using an AlarmManager and I need to find out how many milliseconds are left from the current time until midnight. Here's my code:
AlarmManager mAlarmManager =…

Shlomo Zalman Heigh
- 3,968
- 8
- 41
- 71
35
votes
4 answers
Java date parsing with microsecond or nanosecond accuracy
According to the SimpleDateFormat class documentation, Java does not support time granularity above milliseconds in its date patterns.
So, a date string like
2015-05-09 00:10:23.999750900 // The last 9 digits denote nanoseconds
when parsed via the…

PNS
- 19,295
- 32
- 96
- 143
34
votes
3 answers
How to convert milliseconds to seconds with precision
I want to convert milliseconds to seconds (for example 1500ms to 1.5s, or 500ms to 0.5s) with as much precision as possible.
Double.parseDouble(500 / 1000 + "." + 500 % 1000); isn't the best way to do it: I'm looking for a way to get the remainder…

Keir Nellyer
- 913
- 5
- 12
- 20
31
votes
4 answers
Which one is recommended: Instant.now().toEpochMilli() or System.currentTimeMillis()
In Java, we can have many different ways to get the current timestamp, but which one is recommended:
Instant.now().toEpochMilli() or System.currentTimeMillis()

Yishu Fang
- 9,448
- 21
- 65
- 102
29
votes
9 answers
How to convert Milliseconds to date format in C#?
In C# how can I convert Unix-style timestamp to yyyy-MM-ddThh:mm:ssZ?

danny
- 1,969
- 3
- 16
- 26
29
votes
5 answers
Getting current date in milliseconds (UTC) (NO use of strings)
Well, you might think that this question has already been asked, but I think it has not. The solutions I've read about all had this "jigsaw puzzle" technique (like getUTCMonth() + getUTCMinutes + ...).
But as I only want to compare the elapsed…

syntaxerror
- 661
- 2
- 6
- 24
26
votes
3 answers
length of System.currentTimeMillis
Does System.currentTimeMillis always returns a fixed length of value. In my windows Core2, it return a 13 digit long value.
From its API:
Returns the current time in milliseconds. Note that while the unit of time of the return value is a…

as.tek
- 937
- 3
- 14
- 20
24
votes
7 answers
Java - alternative to thread.sleep
I have a requirement to pause a while loop for a specific number of milliseconds. I have tried using Thread.sleep(duration) but it is not accurate, especially in a looping scenario. Millisecond accuracy is important in my program.
Here is the…

user1189747
- 241
- 1
- 2
- 3
24
votes
3 answers
SQL convert time to milliseconds
I have this time-duration: 00:00:23.323
I want to convert it in sql to milliseconds.
EDIT://
I tried this but it isn't very nice:
SELECT (DATEPART(hh,'12:13:14.123') * 60 * 60 * 1000)
SELECT (DATEPART(n,'12:13:14.123') * 60 * 1000)
SELECT …

Lingo
- 580
- 2
- 7
- 26