Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Php strtotime() will do the trick for adding values to time or date</p> <pre><code>$1hrInFuture = strtotime('now +1 hours'); </code></pre> <p>str2time (now); will understand now as the server's current time, and will add 1 hrs to it, you can add +1 weeks, +1 months...etc.</p> <p>to make it formatted correctly, use the date:</p> <pre><code>$1hrInFutureF = date('Y-m-d H:i:s',$1hrInFuture); </code></pre> <p>this example will get the current servers date, and add 1hr to it;</p> <h2>Note: not using 'now' in the strtotime will generate the date 'January 1 1970 00:00:00 UTC';</h2> <p>Now you can get the date from the database, insert it into the strtotime, add 1 hr to it, format it the way you want, and insert it back to a new column.</p> <p>and for the different timezone between the mysql n the server, you can create a column in that db, set a randdom hash inside the inserted row, the select that row's normal_date, and insert the +1 hr date using the current_time_stamp and the random number</p> <pre><code>INSERT INTO X (title,rnd_nb) VALUES ('titke','rnd_nb); SELECT ID FROM X WHERE rnd_nb = $rnd_nb(php variable inside the function); UPDATE `x` SET (1hrplus_date='$the_variable_containing_the_future_time') WHERE id='the_id_grabbed_from_the_second_query); </code></pre> <p>So if you see, we inserted a random number there,automaticaly if its the currenttimestamp, it will add the current_time_stamp..etc and selected the row containing that number, got it's id, , then get the currenttimestamp, put it in the strtotime function to add 1 hr to it, update that row, and set the +1hrcolumn using the strtotime output.</p> <p>Hope that's useful :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload