Download 1997 Haunted Riddim VIP REPAY STACK :.
Oct 3, 2019
15.
References
External links
Official site
interview
Audio P2P
Category:Ghanaian musicians
Category:Musicians from Accra
Category:Living people
Category:Year of birth missing (living people)
Category:Ghanaian people stubsQ:
Is it a good practice to set the date to 1 day?
In PHP, is there any reason not to set the $today parameter to 1 day, or even 1 minute, etc. if the difference between current date and the beginning of time will only be used for display purposes? For example, I have code to update a user's last activity, but I have multiple dates that represent the last activity:
$time_now = date('Y-m-d H:i:s');
$time_before = '1998-01-01 00:00:00';
$last_activity = $this->time_last_activity($user, $time_now, $time_before);
Obviously, it's far more efficient to use the current date, but I don't want to get too many complaints about "I'll go to the great date's heaven for X hours" or whatever.
A:
I'd use the current date, and set the time to midnight.
$time_now = date('Y-m-d H:i:s', time());
$time_before = '1998-01-01 00:00:00';
$last_activity = $this->time_last_activity($user, $time_now, $time_before);
This makes the code more readable (less variables, less to type) and also prevents user from thinking that there's some time restriction.
If you want to show something like "5 seconds ago", you can do a small function.
function time_since($date1, $date2) {
$time_1 = strtotime($date1);
$time_2 = strtotime($date2);
return ($time_1 - $time_2) / (3600 * 24);
}
$last_activity = time_since($time_now, $time_before);
A: be359ba680
Related links:
Comments