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 .

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

26619 questions
3260
votes
43 answers

How to get the current time in Python

What is the module/method used to get the current time?
user46646
  • 133,483
  • 43
  • 73
  • 82
1923
votes
7 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
1577
votes
39 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
  • 60,897
  • 45
  • 146
  • 152
1328
votes
50 answers

Add days to JavaScript Date

How to add days to current Date using JavaScript. Does JavaScript have a built in function like .Net's AddDay?
Ashesh
  • 13,349
  • 3
  • 16
  • 8
1324
votes
30 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
  • 25,570
  • 20
  • 66
  • 94
1278
votes
33 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
  • 17,706
  • 16
  • 47
  • 93
1174
votes
41 answers

How to get current time and date in Android

How can I get the current time and date in an Android app?
M7M
  • 11,791
  • 3
  • 13
  • 4
930
votes
16 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
  • 17,803
  • 26
  • 116
  • 179
785
votes
14 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
  • 20,387
  • 19
  • 57
  • 135
699
votes
27 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
  • 27,605
  • 60
  • 159
  • 243
615
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
  • 8,542
  • 10
  • 33
  • 48
614
votes
15 answers

Get current time in milliseconds in Python?

How can I get the current time in milliseconds in Python?
Naftuli Kay
  • 75,812
  • 80
  • 244
  • 374
597
votes
28 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…
Click Upvote
  • 235,452
  • 251
  • 553
  • 736
544
votes
31 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
  • 7,142
  • 3
  • 34
  • 48
518
votes
20 answers

NOW() function in PHP

Is there a PHP function that returns the date and time in the same format as the MySQL function NOW()? I know how to do it using date(), but I am asking if there is a function only for this. For example, to return: 2009-12-01 00:00:00
MoeAmine
  • 5,476
  • 2
  • 15
  • 20
1
2 3
99 100