Questions tagged [time-format]

Time formats are specifications used for unambiguous representation of dates and times. The International Standard for the representation of dates and times is ISO 8601. Each software platform usually provides APIs in order to parse dates or time in a language-independent manner.

Time formats are specifications used for unambiguous representation of dates and times. The International Standard for the representation of dates and times is ISO 8601.


Resources :

352 questions
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
1501
votes
39 answers

Where can I find documentation on formatting a date in JavaScript?

I noticed that JavaScript's new Date() function is very smart in accepting dates in several formats. Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new Date("20 09 2006,12:52:39") I could not find…
Naga Kiran
  • 8,585
  • 5
  • 43
  • 53
997
votes
41 answers

Get month name from Date

How can I generate the name of the month (e.g: Oct/October) from this date object in JavaScript? var objDate = new Date("10/11/2009");
Shyju
  • 214,206
  • 104
  • 411
  • 497
610
votes
33 answers

Javascript add leading zeroes to date

I've created this script to calculate the date for 10 days in advance in the format of dd/mm/yyyy: var MyDate = new Date(); var MyDateString = new Date(); MyDate.setDate(MyDate.getDate()+10); MyDateString = MyDate.getDate() + '/' +…
Julian Coates
  • 6,129
  • 3
  • 16
  • 5
408
votes
47 answers

JavaScript seconds to time string with format hh:mm:ss

I want to convert a duration of time, i.e., number of seconds to colon-separated time string (hh:mm:ss) I found some useful answers here but they all talk about converting to x hours and x minutes format. So is there a tiny snippet that does this in…
medk
  • 9,233
  • 18
  • 57
  • 79
393
votes
37 answers

Convert seconds to HH-MM-SS with JavaScript?

How can I convert seconds to an HH-MM-SS string using JavaScript?
Hannoun Yassir
  • 20,583
  • 23
  • 77
  • 112
226
votes
19 answers

How to convert milliseconds to "hh:mm:ss" format?

I'm confused. After stumbling upon this thread, I tried to figure out how to format a countdown timer that had the format hh:mm:ss. Here's my attempt - //hh:mm:ss String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis), …
mre
  • 43,520
  • 33
  • 120
  • 170
139
votes
9 answers

How do I convert datetime to ISO 8601 in PHP

How do I convert my time from 2010-12-30 23:21:46 to ISO 8601 date format? (-_-;)
wow
  • 7,989
  • 17
  • 53
  • 63
124
votes
4 answers

PHP Timestamp into DateTime

Do you know how I can convert this to a strtotime, or a similar type of value to pass into the DateTime object? The date I have: Mon, 12 Dec 2011 21:17:52 +0000 What I've tried: $time = substr($item->pubDate, -14); $date = substr($item->pubDate,…
JREAM
  • 5,741
  • 11
  • 46
  • 84
81
votes
6 answers

How to display a date as iso 8601 format with PHP

I'm trying to display a datetime from my MySQL database as an iso 8601 formated string with PHP but it's coming out wrong. 17 Oct 2008 is coming out as: 1969-12-31T18:33:28-06:00 which is clearly not correct (the year should be 2008 not 1969) This…
Matthew James Taylor
  • 4,806
  • 5
  • 29
  • 33
72
votes
8 answers

Getting Hour and Minute in PHP

I need to get the current time, in Hour:Min format can any one help me in this.
user169964
70
votes
23 answers

Javascript: convert 24-hour time-of-day string to 12-hour time with AM/PM and no timezone

The server is sending a string in this format: 18:00:00. This is a time-of-day value independent of any date. How to convert it to 6:00PM in Javascript? I could prepend today's date as a string to the value sent by the server and then parse the…
Tim
  • 8,669
  • 31
  • 105
  • 183
44
votes
2 answers

Convert ISO 8601 to unixtimestamp

How can I convert 2012-01-18T11:45:00+01:00 (ISO 8601) to 1326883500 (unixtimestamp) in PHP?
Codler
  • 10,951
  • 6
  • 52
  • 65
40
votes
3 answers

/usr/bin/time --format output elapsed time in milliseconds

I use the /usr/bin/time program to measure the time for a command. with the --format parameter i can format the output. e.g. /usr/bin/time -f "%e" ls is there a way to output a bigger accuracy of the elapsed seconds? or just output milliseconds,…
Preexo
  • 2,102
  • 5
  • 29
  • 37
31
votes
3 answers

Get Real Time - Not Device Set Time in android

How to find out the Real Geographical Time, as in my application I want to attach the real time with my application. So that if the user changes the time in his device then I should get only the real prevailing time - NOT THE DEVICE TIME My question…
Ashish Dwivedi
  • 8,048
  • 5
  • 58
  • 78
1
2 3
23 24