Next Friday Date
Hello,
I know that I can use date() in order to get the current date, but I would like to know how can i get the next friday's date. Thanks. |
Re: Next Friday Date
1 day is 86400 seconds, so just use math to determine it
|
Re: Next Friday Date
maybe it will be easier to get the current date and the current day??
but if you think that your way is easier can you write me an example? thanks. |
Re: Next Friday Date
Obtain the current Day of the Week
Then determine how many days away Friday is Then add that many days in seconds to the current timestamp Obtain the date of the new timestamp |
Re: Next Friday Date
Code:
This assumes you want to start displaying next weeks friday as soon as this friday begins. If you want it to change after this friday is over you just change Code:
Code:
|
Re: Next Friday Date
Using floatround_floor for division is the same as integer division. I.e. you can simply do: "( curTime % 604800 ) / 86400"
Also, the code will break after February 29th, 2016 due to leap years. |
Re: Next Friday Date
Quote:
I changed to integers though, much better. Thank you. I noticed now It's not calculating correctly. I've tried to fix it, but I don't understand it fully. I HATE date/time calculations. |
Re: Next Friday Date
Quote:
|
Re: Next Friday Date
Thank you all, it works great!
|
Re: Next Friday Date
Quote:
But I will try fixing it today. |
| All times are GMT -4. The time now is 06:23. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.