Shadowing Posted January 1, 2012 Share Posted January 1, 2012 Hey guys only thing i can find online is examples of showing how much time is left until a predetermind time. but what I need is how many minutes are left until the next hour hits anyone have any ideas on this? Im wanting to do it in UNIX time Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2012 Share Posted January 1, 2012 Have you tried actually writing some code? It's not rocket science. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 1, 2012 Author Share Posted January 1, 2012 yah this is the closest as I got $next = ($time + '+3600'); this puts me a hour ahead always which isnt what i need so I dont know how to predetermind the time of every hour Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2012 Share Posted January 1, 2012 Sorry but I would seriously consider getting a new hobby. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 1, 2012 Author Share Posted January 1, 2012 i can add time or subtract time. I can even compare time such as $current = time(); $future = ($current + '+3600'); $time_left = ($future - $current); i dont know how to have the $future as always the next hour coming up Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 1, 2012 Author Share Posted January 1, 2012 oh wait lol i think i just realize how to do this maybe i dont need to figure out the hour that is approaching i just need to know that there are 60 minutes in a hour and compare how many minutes into the hour i am already Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2012 Share Posted January 1, 2012 I'll give you a hint, take a look at date. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 1, 2012 Author Share Posted January 1, 2012 yah I use date all the time I figured it out not sure if this is how you would do it. i'll add some notes incase someone else stumbles onto this. $time = the players time with their timezone offset in UNIX time stamp $ahead = date('i', $time); // displays users time in minutes $time_left = (60 - $ahead); // compares the minutes in the hour with how many minutes minutes are in a hour which is 60 echo $time_left; my way of thinking about how to do it was totally backwards. Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2012 Share Posted January 1, 2012 Numbers aren't strings. They should not be surrounded by quotes. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 1, 2012 Author Share Posted January 1, 2012 thanks for that information I first had '60' but it gave me a snytax error so i added the quotes in confusion. But really the reason i had a error was cuase i forgot a simi colon and didnt change it back lol. I acctually didnt add anything but my text editor made it show 60 as red and wasnt sure if that was good or bad ha. nice to know now that i dont need ' ' now that i know quotes are for strings i go look up what ' ' are for. cause ive seen people doing that. for instance the 'i' in the date function has it Quote Link to comment Share on other sites More sharing options...
trq Posted January 1, 2012 Share Posted January 1, 2012 now that i know quotes are for strings i go look up what ' ' are for. cause I've seen people doing that. for instance the 'i' in the date function has it " and ' are both quotes. If you look at the man page for the date function it tells you the the $format argument is expected to be a string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.