time

PHP: Best way to convert a datetime to just time string?

放肆的年华 提交于 2020-01-06 04:43:05
问题 I have a datetime that I pulled from the database that looks like this: 2000-01-01 08:00:00 Now I need to convert it so all I have left is: 08:00:00 What is the best way to do this? 回答1: substr('2000-01-01 08:00:00', 11); 回答2: You could use substr($timestamp, -8); 回答3: you can also use the php strtotime function to turn it into a datetime object, then use the format method on it to get a pretty representation however you want. That way you can put in am/pm, do 24 hour or 12 hour, do whatever

How to get of two time values using jQuery/Javascript?

会有一股神秘感。 提交于 2020-01-06 04:28:19
问题 I have two values that are used for the amount of time it will take to complete a task. How can I add these values together to come up with a total number of hours and minutes, but still have the value account for 60 minutes equalling one hour? The two values I'd like to get the sum of and the total value are in HH:MM (00:00) format. Thanks! 回答1: Here's something I had laying around. It allows for an infinite number of arguments, so you could have addTime('01:00') or addTime('01:00', '02:00',

How to count how many hours inside an hour range?

半腔热情 提交于 2020-01-06 04:12:06
问题 Can you help me with this? I am creating an event planner and I have a function that consist of hour range. For example I have an event BIRTHDAY and this event is started from 13:15:00 hours to 18:30:00 hours. Now how can I count the hours inside this range? I have a code like this: <?php $start = "13:15:00"; $end = "18:30:00"; $time = strtotime($start); $timeStop = strtotime($end); //how can I count the hours inside? ?> 回答1: You could use gmdate() in this case: $time = gmdate('H:i:s',

Pygame time control

不打扰是莪最后的温柔 提交于 2020-01-06 02:50:08
问题 I've been thinking in pygame how can i control time. Namely, when an if-statement is True , i want it True just for some seconds, Which is the best pygame.time-object to use? Example if p.rect.left < self.rect.centerx < p.rect.right and self.rect.bottom >= 560: self.kill() p.image.fill(red) This is a ball bounce-collision and whenever this statement is True i want it to stay True just for an amount of time. How can I do that? :D 回答1: have you tried using the function pygame.time.get_ticks() ?

Pygame time control

霸气de小男生 提交于 2020-01-06 02:50:00
问题 I've been thinking in pygame how can i control time. Namely, when an if-statement is True , i want it True just for some seconds, Which is the best pygame.time-object to use? Example if p.rect.left < self.rect.centerx < p.rect.right and self.rect.bottom >= 560: self.kill() p.image.fill(red) This is a ball bounce-collision and whenever this statement is True i want it to stay True just for an amount of time. How can I do that? :D 回答1: have you tried using the function pygame.time.get_ticks() ?

record how long a variable was above a level in r

扶醉桌前 提交于 2020-01-06 02:25:08
问题 I am working on converting a project that I currently have programmed in Excel to R. The reason for doing this is that the code includes lots of logic and data which means thats Excel's performance is very poor. So far I have coded up around 50% of this project in R and I am extremely impressed with the performance. The code I have does the following: Loads a 5min time-series data of a stock and adds a day of the year column labeled doy in this example below. The OHLC data looks like this:

record how long a variable was above a level in r

江枫思渺然 提交于 2020-01-06 02:25:06
问题 I am working on converting a project that I currently have programmed in Excel to R. The reason for doing this is that the code includes lots of logic and data which means thats Excel's performance is very poor. So far I have coded up around 50% of this project in R and I am extremely impressed with the performance. The code I have does the following: Loads a 5min time-series data of a stock and adds a day of the year column labeled doy in this example below. The OHLC data looks like this:

hh:mm aa (12 hour format ) convert in HH:mm (24 hour format)

。_饼干妹妹 提交于 2020-01-06 01:50:09
问题 I have String time="02:30 PM" means 12 hour format and i want to convert this time in 24 hour format . I want this o/p: 14:30 . so how can i convert this ? 回答1: I don't know anything about berries, but in case the API is missing a proper formatting function, you can always get your hands dirty with the string itself: static String convert(String time){ boolean pm = "PM".equals(time.substring(6).toUpperCase()); int h = Integer.valueOf(time.substring(0,2)); if (h!=12) h+=pm?12:0; else h=pm?h:0;

PHP/MySQL Display time since user's last login

爱⌒轻易说出口 提交于 2020-01-05 14:23:49
问题 I don't know what kind of value I should store in the database. I'm thinking I should do something like this, but I don't know how: Store the years, days, hours, minutes since a give date like 1/1/2000 Then at another time I will compare that value against the current years, days, hours, and minutes since 1/1/2000. Obviously, the difference between the two would be the time since the user's last login. I appreciate any help anyone can provide on this. Thanks in advance 回答1: mysql will do this

How to plot data with lines like “<text> <datetime>”, with gnuplot?

柔情痞子 提交于 2020-01-05 11:04:26
问题 My data is a typical CSV-like text where each line consists of two columns where the first is text and the second a unix timestamp, as follows: Mom 1441008169 Dad 1442516527 Ken 1441783871 ... <text> <unix-timestamp> I thought I could arrange the data along a timeline, drawing dots/shapes of color corresponding to the text in the line, at a point along the x axis corresponding to the timestamp. At best I got gnuplot to tell me: line 0: Need using spec for y time data when I tell it to: set