RE: [PHP-DB] Date Time 90 minutes ago
?php echo date(Y-m-d H:i:s,strtotime(90 minutes ago)); ? bastien From: Ron Piggott (PHP) [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: PHP DB php-db@lists.php.net Subject: [PHP-DB] Date Time 90 minutes ago Date: Thu, 19 Jan 2006 16:57:33 -0500 Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Time 90 minutes ago
$date_90_minutes_ago = date('m/d/Y',mktime()-(60*90)); $time_90_minutes_ago = date('h:i:s',mktime()-(60*90)); 60 seconds * 90 minutes. =C= | | Cal Evans | http://www.calevans.com | | We get our best customers from referrals. | We would appreciate you referring any of your | friends or co-workers that need web hosting. | | Ron Piggott (PHP) wrote: Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date Time 90 minutes ago
Bastien's example is probably the quickest and easiest. I just wanted to point out that you can use math within the mktime() function as well in case the relative date/time you need isn't right now. $month = 1; $day = 19; $year = 2006; $hour = 17; $minute = 08; $second = 05; echo date(Y-m-d H:i:s, mktime($hour, $minute - 90, $second, $month, $day, $year)); It will even adjust for leap years I believe. You can add/subtract/etc any of those items and it's smart enough to figure out what the correct resulting date/time would be. -TG = = = Original message = = = ?php echo date(Y-m-d H:i:s,strtotime(90 minutes ago)); ? bastien From: Ron Piggott (PHP) [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: PHP DB php-db@lists.php.net Subject: [PHP-DB] Date Time 90 minutes ago Date: Thu, 19 Jan 2006 16:57:33 -0500 Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php