Questions Tagged [Milliseconds]
93 questions
271 votes
15 answers
600k views

Format a datetime into a string with milliseconds

How can I format a datetime object as a string with milliseconds?
  • 7,545
33 votes
2 answers
46k views

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 ...
  • 18.4k
139 votes
17 answers
309k views

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 = ...
  • 4,759
385 votes
14 answers
486k views

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 ...
100 votes
4 answers
167k views

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 ...
  • 8,230
93 votes
5 answers
104k views

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 <...
  • 1,217
123 votes
23 answers
219k views

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.
  • 1,559
17 votes
2 answers
28k views

How can I get millisecond and microsecond-resolution timestamps in Python?

How do I get millisecond and microsecond-resolution timestamps in Python? I'd also like the Arduino-like delay() (which delays in milliseconds) and delayMicroseconds() functions. I read other answers ...
384 votes
16 answers
491k views

How to get current time in milliseconds in PHP?

time() is in seconds - is there one in milliseconds?
  • 4,761
5 votes
2 answers
15k views

Do something every x (milli)seconds in pygame

I'm learing Python and Pygame, and my first thing I'm making is a simple Snake game. I'm trying to make it so that the snake moves once every 0.25 seconds. Here is the part of my code that loops: ...
127 votes
17 answers
262k views

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 ...
95 votes
9 answers
258k views

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)?
268 votes
12 answers
481k views

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 ...
  • 2,691
54 votes
4 answers
113k views

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::...
  • 7,647
23 votes
7 answers
57k views

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 ...

15 30 50 per page
1
2 3 4 5
…
7
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest