seconds

How to get the current UTC time in seconds

别等时光非礼了梦想. 提交于 2019-12-06 18:53:13
问题 I have an application, which needs to compare the time in seconds. I want to know how to get the current UTC time in seconds. Can some one post an example of it how can we do this in Java? 回答1: You can use this to get timezone passing in timezone you want time back in Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Then you can call whatever you want on the calendar object System.out.println(cal.get(Calendar.YEAR)); System.out.println(cal.get(Calendar.HOUR)); System.out

Converting MM:SS.ms to seconds using MS excel

夙愿已清 提交于 2019-12-05 11:33:30
问题 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 excel feature to do this for me :P Thanks! 回答1: Do this: Place values 0:0:11.111 and 0:1:11.111 in cells B3 and B4 respectively. Now format it to account for the milliseconds... Select cells B3 and B4 , right click and choose Format Cells. In Custom,

Convert Seconds to datetime timedelta [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 04:14:05
This question already has an answer here: How do I convert seconds to hours, minutes and seconds? 10 answers In python how can I simply convert an integer of seconds into (h:m:s) using the datetime module? i.e. 500000 ---> 138:53:20 Please, no tuple hackery. Belphegor Maybe this answer from SO will do: >>> import datetime >>> str(datetime.timedelta(seconds=500000)) '5 days, 18:53:20' 来源: https://stackoverflow.com/questions/25193464/convert-seconds-to-datetime-timedelta

How to get the current UTC time in seconds

天涯浪子 提交于 2019-12-05 00:13:29
I have an application, which needs to compare the time in seconds. I want to know how to get the current UTC time in seconds. Can some one post an example of it how can we do this in Java? You can use this to get timezone passing in timezone you want time back in Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Then you can call whatever you want on the calendar object System.out.println(cal.get(Calendar.YEAR)); System.out.println(cal.get(Calendar.HOUR)); System.out.println(cal.get(Calendar.HOUR_OF_DAY)); System.out.println(cal.get(Calendar.MINUTE)); Below example to compare

php - How To Convert 1 day To Seconds

旧巷老猫 提交于 2019-12-04 01:27:00
问题 I am creating a form to set publish interval and want to sum all of the submitted values into seconds. The form consist of fields to determine seconds, minutes, hours, day and so on. I am collecting the submitted values to string by giving date attributes, like second, minute etc. For example: $second second $minute minute $hour hour So if user input 1 in input field to determine the interval in day and 30 in minute , then my code will convert it to string 1 day and 30 minute . My questions:

Converting MM:SS.ms to seconds using MS excel

ぃ、小莉子 提交于 2019-12-04 01:18:59
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 excel feature to do this for me :P Thanks! Do this: Place values 0:0:11.111 and 0:1:11.111 in cells B3 and B4 respectively. Now format it to account for the milliseconds... Select cells B3 and B4 , right click and choose Format Cells. In Custom, put the following in the text box labeled Type : [h]:mm:ss.000 Now on cell C3 put the following formula: =B3

Convert DateInterval object to seconds in php

情到浓时终转凉″ 提交于 2019-12-03 01:44:18
$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 There is a function format for this. But it wont return the number of seconds. To get number of seconds you use this technique $seconds = abs($datetime1->getTimestamp()-$datetime2->getTimestamp()); If you really want to use $interval you need to calculate it. $seconds = $interval->days*86400 + $interval->h*3600 + $interval->i*60 + $interval->s; Here 86400 is the number of seconds in a day 3600 is the number of

Converting milliseconds to minutes and seconds with Javascript

别等时光非礼了梦想. 提交于 2019-12-02 15:24:37
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 this: 4:59 Here's one that got close, but doesn't work. It doesn't stop the seconds at 60. It goes all the way to 99 which makes no sense. Try entering "187810" as a value of ms, for example. var ms = 298999, min = Math.floor((ms/1000/60) << 0), sec = Math.floor((ms/1000) % 60); console.log(min + ':' + sec); Thanks for your help! If you could add in

How to convert getTime() to 'YYYY-MM-DD HH24:MI:SS' [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-02 13:25:44
This question already has an answer here: Convert timestamp in milliseconds to string formatted time in Java 9 answers I Have the following code in my application System.out.println(rec.getDateTrami().getTime()); I need to convert the following format (I suppose that they are seconds) 43782000 29382000 29382000 To a format YYYY-MM-DD HH24:MI:SS , anyone can help to me? Jonas Michel You can make use of the SimpleDateFormat Example: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = new Date(); date.setTime(rec.getDateTrami().getTime()); System.out.println(format

Convert QDate to seconds

Deadly 提交于 2019-12-02 05:33:30
问题 I take date from QDateTimeEdit and convert it to seconds like this: import time from datetime import datetime date = self.__ui.dateTimeEdit.date().toString("dd/MM/yy") dateString = str(date) seconds = time.mktime(datetime.strptime(dateString, "%d/%m/%y").timetuple()) This works well, but since it looks to long to me, my question is: Is it possible to convert self.__ui.dateTimeEdit.date() directly, without those string conversions? EDIT1 Unfortunately toMSecsSinceEpoch() as falsetru suggested,