hour

Fastest way to extract hour from time (HH:MM)

本秂侑毒 提交于 2020-01-02 00:53:09
问题 Wish fastPOSIXct works - but not working in this case. Here is my time data (which does not have dates) - and I need to get the hours-part from them. times <- c("9:46","11:06", "14:17", "19:53", "0:03", "3:56") Here is the wrong output from fastPOSIXct : fastPOSIXct(times, "GMT") [1] "1970-01-01 00:00:00 GMT" "1970-01-01 00:00:00 GMT" [3] "1970-01-01 00:00:00 GMT" "1970-01-01 00:00:00 GMT" [5] "1970-01-01 00:00:00 GMT" "1970-01-01 00:00:00 GMT" It does not recognize the times without the

Extracting 2 digit hour from POSIXct in R

夙愿已清 提交于 2019-12-30 11:04:09
问题 I would like to extract the hour from a POSIXct time in R, but retrieve the 2 digit answer. For example, test=as.POSIXct("2015-03-02 03:15:00") test [1] "2015-01-02 03:15:00 GMT" month(testing) [1] 1 hour(testing) [1] 3 The results give the relevant month and hour, but I would like to see 01 and 03 instead of just 1 and 3 . 回答1: Try to do this: strftime(test, format="%H") to extract hours and strftime(test, format="%m") for month 来源: https://stackoverflow.com/questions/35227648/extracting-2

mysql retrieve difference between current and last hour

旧时模样 提交于 2019-12-25 04:41:10
问题 For the below table, i would like to get the difference between last hour and current hour for col-D and col-E for each of the site. As part of that I am trying to first get the latest (current) hour entries for each of the site, but the following query is only listing me the entries with endTime as 01:00:00, when i have entries upto 9.00AM select distinct(mmeName), endDate, endTime, c_ratio, set_time from attach where type='INIT' and Date(endDate)=curDate() and Time(endTime) >= DATE_ADD(Time

MySQL: Using SQL having trouble figuring out the busiest hour for each day that has the maximum “in_bytes”?

浪子不回头ぞ 提交于 2019-12-24 12:35:01
问题 Goal: Write the correct SQL to solve the problems below. Part 1: Having trouble figuring out the SQL statement on how to get the timestamp that includes the date and the hour where you have the maximum "in_bytes" for each day. See "video_hourly" table DDL code below. If there are two maximum values that have the same value in a given day just pick the first one. This data is being graphed in highcharts so there can only be one data point for each given day. You can fill the table with some

How do I get the number of days for a duration where the number of hours exceeds 24 in google sheets?

為{幸葍}努か 提交于 2019-12-24 10:22:45
问题 I am using google sheets where there is a duration value of 69:41:00 where it's 69 hours, 41 minutes, 0 secs. There doesn't seem to be a function to convert this to days, hours and minutes so I did some searching and some had suggested a custom function. Not sure exactly how it works but made some changes from the original to fit what I needed. The code below: /** * Format Duration to Days,Hours,Minutes * * @param {duration} input value. * @return Days,Hours,Minutes. * @customfunction */

How can I prevent my Google App Engine cron jobs from burning through all my instance hours?

一个人想着一个人 提交于 2019-12-24 04:03:15
问题 I have a google app engine where I have scheduled several cron jobs as database cleanup tasks, but these cron jobs are burning through all my instance hours (front or back), even though the actual processing time of each of these jobs is almost nothing. Am I doing something wrong? Is there a way I can configure these background tasks to occur without wasting all my instance hours? 回答1: Take a look at the documentation here: http://code.google.com/appengine/docs/adminconsole/instances.html

Calculate difference between 2 dates considering Daylight Saving Time

ε祈祈猫儿з 提交于 2019-12-23 21:32:15
问题 Given a start date, and a number of days, I need to display the end date = start date + number of days. So I did something like this: var endDate=new Date(startDate.getTime()+ONE_DAY); Everything works fine, except that for 25 and 26 October gives one day less. Ex.: 2014-01-01 + 2 days = 2014-01-03 2014-10-25 + 2 days = 2014-10-26 (here is the case I need to treat). This difference appear because of the clock going back 1 hour. Practically 2014-10-27 00:00:00 becomes 2014-10-26 23:00:00 . A

SQL add Datetime add hour add Minute

余生颓废 提交于 2019-12-23 14:57:27
问题 In my table I have DateTime , Hour column. example : 2012-05-14 00:00:00.000 and 1230 How can I add this hour column into my Datetime column, so I can have 2012-05-14 12:30:00.000 I tried with this: SELECT DATE_DEBUT, HEURE_DEBUT, DATEADD(hour, CONVERT(int, SUBSTRING(HEURE_DEBUT, 0, 2)), DATE_DEBUT) AS DateTemp, DATEADD(hour, CONVERT(int, SUBSTRING(HEURE_DEBUT, 2, 2)), DateTemp) AS DateComplete FROM ESPTEMPS_PROGRAMMATION but it does not work. thanks you in advance, Stev 回答1: From what I

How to calculate hour:minutes from total minutes?

心已入冬 提交于 2019-12-19 18:24:27
问题 For example i have 525 minutes, if we will divide it by 60 the result will be 8.75 But 1 hour have only 60 minutes not 75 How can i calculate the exact hour:minutes from total minutes? 回答1: $hours = intval($totalMinutes/60); $minutes = $totalMinutes - ($hours * 60); Edited to be PHP 回答2: This kind of conversion is done using integer division and the modulo operator. With integer division you find out how many of the "large" unit you have and with modulo you find out how many of the "small"

Time inconsistencies in Python

ぐ巨炮叔叔 提交于 2019-12-19 04:43:06
问题 I am facing some problems in a cross platform program: when I open a python shell in Linux and in Windows, I don't get the same time from the Epoch. In Linux, I tried to do dpkg-reconfigure tzdata . Currently, in linux I get that avec the dpkg-reconfigure tzdata: Current default time zone: 'Europe/London' Local time is now: Mon May 30 10:29:52 BST 2011. Universal Time is now: Mon May 30 09:29:52 UTC 2011. Then, in the python console, I create this script: import time print time.tzname, time