A millisecond is a thousandth (1/1,000) of a second.
Questions tagged [milliseconds]
660 questions
420
votes
14 answers
How to get milliseconds from LocalDateTime in Java 8
I am wondering if there is a way to get current milliseconds since 1-1-1970 (epoch) using the new LocalDate, LocalTime or LocalDateTime classes of Java 8.
The known way is below:
long currentMilliseconds = new Date().getTime();
or
long…

Georgios Syngouroglou
- 18,813
- 9
- 90
- 92
412
votes
16 answers
How to get current time in milliseconds in PHP?
time() is in seconds - is there one in milliseconds?

COMer
- 5,091
- 4
- 22
- 20
352
votes
15 answers
Format a datetime into a string with milliseconds
How can I format a datetime object as a string with milliseconds?

Jurudocs
- 8,595
- 19
- 64
- 88
284
votes
12 answers
Get DateTime.Now with milliseconds precision
How can I exactly construct a time stamp of actual time with milliseconds precision?
I need something like 16.4.2013 9:48:00:123. Is this possible? I have an application, where I sample values 10 times per second, and I need to show them in a…

LuckyHK
- 2,851
- 2
- 13
- 6
172
votes
10 answers
Get time in milliseconds using C#
I'm making a program in which I need to get the time in milliseconds. By time, I mean a number that is never equal to itself, and is always 1000 numbers bigger than it was a second ago. I've tried converting DateTime.Now to a TimeSpan and getting…

Entity
- 7,972
- 21
- 79
- 122
153
votes
18 answers
Getting date format m-d-Y H:i:s.u from milliseconds
I am trying to get a formatted date, including the microseconds from a UNIX timestamp specified in milliseconds.
The only problem is I keep getting 000000, e.g.
$milliseconds = 1375010774123;
$d = date("m-d-Y H:i:s.u", $milliseconds/1000);
print…

slik
- 5,001
- 6
- 34
- 40
142
votes
18 answers
Is there a stopwatch in Java?
Is there a stopwatch in Java?
On Google I only found code of stopwatches that don't work - they always return 0 milliseconds.
This code I found doesn't work and I don't see why.
public class StopWatch {
private long startTime = 0;
private…

user1007522
- 7,858
- 17
- 69
- 113
135
votes
27 answers
How to convert time in milliseconds to hours, min, sec format in JavaScript?
I have a time as a number of milliseconds and I want to convert it to a HH:MM:SS format. It should wrap around, with milliseconds = 86400000 I want to get 00:00:00.

cheliyan
- 1,679
- 3
- 16
- 22
129
votes
11 answers
How can I get the current milliseconds from the current time
Note, I do NOT want millis from epoch. I want the number of milliseconds currently on the clock.
So for example, I have this bit of code.
Date date2 = new Date();
Long time2 = (long) (((((date2.getHours() * 60) + date2.getMinutes())* 60 ) +…

LemonMan
- 2,963
- 8
- 24
- 34
117
votes
15 answers
Converting milliseconds to minutes and seconds with Javascript
Soundcloud's API gives the duration of it's tracks as milliseconds. JSON looks like this:
"duration": 298999
I've tried many functions I found on here to no avail. I'm just looking for something to convert that number to something like looks like…

ElliotD
- 1,279
- 2
- 10
- 9
111
votes
7 answers
What is the duration of a Toast LENGTH_LONG and LENGTH_SHORT
I need the exact duration of LENGTH_LONG and LENGTH_SHORT in milliseconds (ms). Also I need to know if the duration of Toast message with LENGTH_LONG will have the same duration in any phone and with any API version.
Does someone know where is the…

Lukap
- 31,523
- 64
- 157
- 244
110
votes
4 answers
Timestamp with a millisecond precision: How to save them in MySQL
I have to develop a application using MySQL and I have to save values like "1412792828893" which represent a timestamp but with a precision of a millisecond. That is, the amount of milliseconds since 1.1.1970. I declare the row as timestamp but…

Luixv
- 8,590
- 21
- 84
- 121
98
votes
9 answers
How to convert a string Date to long millseconds
I have a date inside a string, something like "12-December-2012".
How can I convert this into milliseconds (long)?

Dawood Ahmed
- 1,734
- 4
- 23
- 36
97
votes
5 answers
How do you specify the date format used when JAXB marshals xsd:dateTime?
When JAXB marshals a date object (XMLGregorianCalendar) into an xsd:dateTime element. How can you specify the format of the resulting XML?
For example:
The default data format uses milliseconds 2012-08-21T13:21:58.000Z
I need…

Young Fu
- 1,257
- 1
- 9
- 12
70
votes
8 answers
milliseconds to days
i did some research, but still can't find how to get the days... Here is what I got:
int seconds = (int) (milliseconds / 1000) % 60 ;
int minutes = (int) ((milliseconds / (1000*60)) % 60);
int hours = (int) ((milliseconds / (1000*60*60)) %…

Reacen
- 2,312
- 5
- 23
- 33