Re: PHP Date()ing logic.....
| From: | Becoming Digital | Date: | Thu, 16 Oct 2003 22:40:32 +0000 |
| Subject: | Re: PHP Date()ing logic..... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166368@lists.php.net to get a copy of this message | ||
If you want to manipulate months in this manner, you'll first need a month input box. Once
you've got that covered, it's just a matter of using mktime() to create the appropriate
date.
Edward Dudlik
"Those who say it cannot be done
should not interrupt the person doing it."
wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU
----- Original Message -----
From: "Ryan A" <ryan@coinpass.com>
To: <php-general@lists.php.net>
Sent: Thursday, 16 October, 2003 15:42
Subject: [PHP] PHP Date()ing logic.....
Hi,
I'm just screwing around with the date() function and timestamps but have
run into a little logic problem...
So far (as you can see with the below posted code) I can manipulate
days,hours and minutes...any idea on how to do months and years?
Lastly the goal of this is to make take all the parameters and make 1
timestamp out of it...any ideas? or links?
The code is really easy to understand and was taken from the manual but have
commented it a bit none the less, so it should be real easy to understand
even without executeing it.
Thanks in advance.
Cheers,
-Ryan
P.S around 20 lines of simple code below, if testing code copy and name your
file t1.php.....
<html><head><title> Testing Dates</title></head>
<body><form type=get action=t1.php><input type=text name=m><input type=text
name=h><input type=text name=d><input
type=submit></form></body></html>
<?php
## minutes ##
echo "<br>**MINUTES**<br>";
$minutes=$_GET['m'];if(!isset($_GET['m'])){$minutes=1;}
echo 'year - mo-da-hr-m - s : - : <b>$minutes</b> is set to
'.$minutes.'<br>';
echo date("Y-m-d-H-i-s")." Current<br>";
echo date("Y-m-d-H-i-s",(time() + $minutes*60));
## hours ##
echo "<br><br>**HOURS**<br>";
$hours=$_GET['h'];if(!isset($_GET['h'])){$hours=1;}
echo 'year - mo-da-hr-m: - : <b>$hours</b> is set to
'.$hours.'<br>';
echo date("Y-m-d-H-i")." Current<br>";
echo date("Y-m-d-H-i",(time() + $hours*3600));
## days ##
echo "<br><br>**DAYS**<br>";
$days=$_GET['d'];if(!isset($_GET['d'])){$days=1;}
echo 'year - mo-da-hr-m : - : <b>$days</b> is set to
'.$days.'<br>';
// $days=24*3600;
echo date("Y-m-d-H-i")." Current<br>";
echo date("Y-m-d-H-i",(time() + $days*(24*3600)));
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php