I currently need to get the previous week from a variable that passes a php week number so if it is week 13 I will get week 12. The problem I am facing is that if I just minus 1 from the original number if I am in week 1 it will return week 0 unless I create an if
Tag: time
PHP get UK local time from Server in different time zone
I have a web server which I do not know what the time zone is set to. it is now 10:49am in the UK, but when I run the following: The server returns the following time. Now I don’t want to just “Add” one hour onto the time because the time still needs to be correct when time moves forward
Convert number of minutes into hours & minutes using PHP
I have a variable called $final_time_saving which is just a number of minutes, 250 for example. How can I convert that number of minutes into hours and minutes using PHP in this format: 4 hours 10 …
Adding 1 hour to time variable
I have a time to which I want to add an hour: I’ve tried: But none of the above work. Answer Worked for me.. Explanation: strtotime(’10:09′) creates a numerical timestamp in seconds, something like 1510450372. Simply add or remove the amount of seconds you need and use date() to convert it back into a human readable format. time() also creates
PHP Time() to Google Calendar Dates time format
I have PHP times for the start and end times of an event. This is a simple <?php time(); ?> for some future date’s start and end time. I was wondering if anyone knew of a way to take either the numerical format (PHP time()) or taking some string value representing that time (I could do a strtotime($sometimevalue);) and turn
Round minute down to nearest quarter hour
I need to round times down to the nearest quarter hour in PHP. The times are being pulled from a MySQL database from a datetime column and formatted like 2010-03-18 10:50:00. Example: 10:50 needs …
Getting Hour and Minute in PHP
I need to get the current time, in Hour:Min format can any one help me in this. Answer Should do it, for the current time. Use a lower case h for 12 hour clock instead of 24 hour. More date time formats listed here.