Questions tagged [time]

Measuring the time it takes to perform an operation. Also, questions related to obtaining the current time, calculating on times, formatting and parsing times, etc.

Measuring the time it takes to perform an operation. Also, questions related to obtaining the current time, calculating on times, formatting and parsing times, etc. See also and .

For analysis in , consider looking at the Time Series Task View.

29686 questions
3784
votes
54 answers

How do I get the current time?

How do I get the current time?
user46646
  • 153,461
  • 44
  • 78
  • 84
2218
votes
8 answers

What do 'real', 'user' and 'sys' mean in the output of time(1)?

$ time foo real 0m0.003s user 0m0.000s sys 0m0.004s $ What do real, user and sys mean in the output of time? Which one is meaningful when benchmarking my app?
Iraimbilanja
1705
votes
39 answers

How do I get time of a Python program's execution?

I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running. I've looked at the timeit module, but it seems it's only for small snippets of code. I want to time the whole program.
john2x
  • 22,546
  • 16
  • 57
  • 95
1647
votes
41 answers

Calculate relative time in C#

Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago
Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
1612
votes
34 answers

Convert a Unix timestamp to time in JavaScript

I am storing time in a MySQL database as a Unix timestamp and that gets sent to some JavaScript code. How would I get just the time out of it? For example, in HH/MM/SS format.
roflwaffle
  • 29,590
  • 21
  • 71
  • 94
1284
votes
43 answers

How to get current time and date in Android

How can I get the current time and date in an Android app?
M7M
  • 12,891
  • 3
  • 15
  • 4
1008
votes
15 answers

How do I measure request and response times at once using cURL?

I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester. I want to measure the request, response, and total time using cURL. My example request looks like: curl -X POST -d @file…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
1004
votes
17 answers

Java string to date conversion

What is the best way to convert a String in the format 'January 2, 2010' to a Date in Java? Ultimately, I want to break out the month, the day, and the year as integers so that I can use Date date = new…
littleK
  • 19,521
  • 30
  • 128
  • 188
890
votes
31 answers

How do I get the day of week given a date?

I want to find out the following: given a date (datetime object), what is the corresponding day of the week? For instance, Sunday is the first day, Monday: second day.. and so on And then if the input is something like today's date. Example >>>…
frazman
  • 32,081
  • 75
  • 184
  • 269
773
votes
16 answers

How do I get the current time in milliseconds in Python?

How do I get the current time in milliseconds in Python?
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
674
votes
9 answers

Does Python's time.time() return the local or UTC timestamp?

Does time.time() in the Python time module return the system's time or the time in UTC?
Saransh Mohapatra
  • 9,430
  • 10
  • 39
  • 50
656
votes
12 answers

What is this date format? 2011-08-12T20:17:46.384Z

I have the following date: 2011-08-12T20:17:46.384Z. What format is this? I'm trying to parse it with Java 1.4 via DateFormat.getDateInstance().parse(dateStr) and I'm getting java.text.ParseException: Unparseable date:…
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
651
votes
35 answers

Getting current date and time in JavaScript

I have a script that prints the current date and time in JavaScript, but the DATE is always wrong. Here is the code: var currentdate = new Date(); var datetime = "Last Sync: " + currentdate.getDay() + "/" + currentdate.getMonth() + "/" +…
Ricardo
  • 11,609
  • 8
  • 27
  • 39
641
votes
34 answers

How do I measure execution time of a command on the Windows command line?

Is there a built-in way to measure execution time of a command on the Windows command line?
Kuroki Kaze
  • 8,161
  • 4
  • 36
  • 48
629
votes
29 answers

How to convert Milliseconds to "X mins, x seconds" in Java?

I want to record the time using System.currentTimeMillis() when a user begins something in my program. When he finishes, I will subtract the current System.currentTimeMillis() from the start variable, and I want to show them the time elapsed using a…
Ali
  • 261,656
  • 265
  • 575
  • 769
1
2 3
99 100