PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
michlcamp
Forum Commoner
Posts: 78 Joined: Mon Jul 18, 2005 11:06 pm
Post
by michlcamp » Wed May 31, 2006 9:04 pm
trying to calculate between two dates and want to format the form input in the same format as the
function does - so that I can replace $today below with something like: $date_in
my script will take care of the rest if I can config it to use any date input instead of
any/all help appreciated!
thanks in advance.mc
Code: Select all
<?php
//get today's date
$today = getdate();
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year'];
$lyear = $year - 105;
?>
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Jun 01, 2006 10:00 am
Not 100% sure what you're asking. Do you want to calculate the time between two dates? How are you getting these two dates - can you generate them yourself or do they come from a form?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
michlcamp
Forum Commoner
Posts: 78 Joined: Mon Jul 18, 2005 11:06 pm
Post
by michlcamp » Thu Jun 01, 2006 10:06 am
this is for an age calculator in a pediatric screening test.
One date ($today) is coded into the form using the getdate() function.
The other I want to come from the form submit.
maybe the faster version of the question is to ask:
how do I convert a form-submitted date from "2006-06-01" to a an array similar to that produced by the getdate() function?
I then have to account for days/weeks premature in order to produce a medically-approved "adjusted age" of child.
hope that clarifies
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Jun 01, 2006 10:14 am
Code: Select all
list($year,$month,$day) = explode('-',$value_submitted_from_form);
$form_values = array('year'=>$year,'month'=>$month,$day=>'day');
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.