Jump to content

how to show how many minutes are left in the current hour


Shadowing

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.