mysql - PHP Display hours until a certain event from a time given -
so basically, wanted happen was, wanted submit article submits current time() , amount of hours until event. wished calculate amount of time in hours time() in database amount of hours since article posted. if posted article event happening @ 3pm, , current time 12pm, "event in 3 hours". , if check again @ 2pm, "event in 1 hours". sorry if seems noob question, quite stupid person when comes maths , stuff. in advance input, appreciate it!
presuming store time of article timestamp, , retrieve value in variable $articletime:
$hoursleft = floor(($articletime - time()) / 3600);
Comments
Post a Comment