Questions tagged [seconds]

333 questions
175
votes
10 answers

jQuery: Wait/Delay 1 second without executing code

I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000); // not working I'm using a while loop to wait until an uncontrolled changing value is greater than or equal to another and I can't find any way to…
Nahydrin
  • 13,197
  • 12
  • 59
  • 101
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
105
votes
12 answers

How to convert an NSTimeInterval (seconds) into minutes

I've got an amount of seconds that passed from a certain event. It's stored in a NSTimeInterval data type. I want to convert it into minutes and seconds. For example I have: "326.4" seconds and I want to convert it into the following…
Ilya Suzdalnitski
  • 52,598
  • 51
  • 134
  • 168
83
votes
3 answers

Java getHours(), getMinutes() and getSeconds()

As I know getHours(), getMinutes() and getSeconds() are all deprecated in Java and they are replaced with Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND. These will in fact return the hour, minute and second for that particular moment.…
mel
  • 831
  • 1
  • 6
  • 6
56
votes
2 answers

Regex pattern for HH:MM:SS time string

I want to parse a hh:mm:ss string. A simple one is ([0-1]?\d|2[0-3]):([0-5]?\d):([0-5]?\d) which expects 2:3:24 or 02:03:24 string. I want to take it a step further and pass the validation even in cases like if you enter just 56, it should be…
user418836
  • 847
  • 3
  • 8
  • 19
46
votes
9 answers

PHP: add seconds to a date

I have $adate; which contains: Tue Jan 4 07:59:59 2011 I want to add to this date the following: $duration=674165; // in seconds Once the seconds are added I need the result back into date format. I don't know what I'm doing, but I am getting odd…
ADM
  • 1,590
  • 11
  • 36
  • 54
41
votes
4 answers

Android difference between two dates in seconds

I've tried different methods around the web but couldn't make it work. Cursor cursor = sqlite.myDataBase.rawQuery("SELECT StartDate, EndDate FROM Tracks Where Id="+'"'+trackId+'"',null); SimpleDateFormat outputFormat = new…
Alin
  • 14,809
  • 40
  • 129
  • 218
30
votes
5 answers

Convert Epoch seconds to date and time format in Java

I have seconds since 1970 january 1 UTC (Epoch time). 1320105600 I need to convert that seconds into date and time in below format. Friday,November 4,2011 5:00,AM How can I achieve this?
androiduser
  • 917
  • 3
  • 11
  • 15
27
votes
7 answers

Datetime.now as TimeSpan value?

I need the current Datetime minus myDate1 in seconds. DateTime myDate1 = new DateTime(1970, 1, 9, 0, 0, 00); DateTime myDate2 = DateTime.Now; TimeSpan myDateResult = new TimeSpan(); myDateResult = myDate2 - myDate1; . . I tried different ways to…
MrMAG
  • 1,194
  • 1
  • 11
  • 34
23
votes
3 answers

Convert DateInterval object to seconds in php

$datetime1 = date_create('2009-10-11'); $datetime2 = date_create('2009-10-13'); $interval = date_diff($datetime1, $datetime2); How do i convert the above $interval to seconds in php
sanchitkhanna26
  • 2,143
  • 8
  • 28
  • 42
20
votes
4 answers

Ruby/Rails - How to convert seconds to time?

I need to perform the following conversion: 0 -> 12.00AM 1800 -> 12.30AM 3600 -> 01.00AM ... 82800 -> 11.00PM 84600 -> 11.30PM I came up with this: (0..84600).step(1800){|n| puts "#{n.to_s} #{Time.at(n).strftime("%I:%M%p")}"} which gives me…
Vincent
  • 16,086
  • 18
  • 67
  • 73
18
votes
4 answers

PHP — Convert milliseconds to Hours : Minutes : Seconds.fractional

I've got a script that takes in a value in seconds (to 2 decimal points of fractional seconds): $seconds_input = 23.75 I then convert it to milliseconds: $milliseconds = $seconds_input * 1000; // --> 23750 And then I want to format it like…
AJB
  • 7,389
  • 14
  • 57
  • 88
17
votes
2 answers

Converting MM:SS.ms to seconds using MS excel

I am looking for a neat way of converting a cell from Minutes:Seconds.Milliseconds to Seconds.Milliseconds i.e. 11.111 = 11.111 1:11.111 = 71.111 I have something in place at the moment but its a bit hacky and I am sure there must be some nice…
Jambobond
  • 619
  • 3
  • 12
  • 23
16
votes
1 answer

Comparing record to previous record in postgresql

I have a table in PostgreSQL DB like this: Client | Rate | StartDate|EndDate A | 1000 | 2005-1-1 |2005-12-31 A | 2000 | 2006-1-1 |2006-12-31 A | 3000 | 2007-1-1 |2007-12-31 B | 5000 | 2006-1-1 |2006-12-31 B |…
Alex
  • 617
  • 2
  • 9
  • 21
15
votes
6 answers

How to get seconds since epoch (1/1/1970) in VBA?

How can I get seconds since epoch (1/1/1970) in VBA?
aF.
  • 64,980
  • 43
  • 135
  • 198
1
2 3
22 23