T
|
tedwilder 12/4/2009 |
_ |
![]() |
ficcionista author 1/14/2010 |
I didnt see this before posting the other day , but the admin just gave me a simple string that works ok for me : it shows a date in 6 months in the future : $values["dateexpire"] = date("Y-m-d",strtotime($values["dateemission"])+(606024306)); It does all you did but in one line ! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=46912&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> Well it has a down side : sometimes the date given is not 100% accurate : it has a 3 days error from time to time but enough accurate for me. ("datemission" is the date to start counting and result is "dateexpire") problem is Im from france I dont use 1912-02-25 so then I have to add this to make it right : $date1=$values["dateexpire"]; $annee=substr($date1, -10, 4); $mois=substr($date1, -5, 2); $jour=$date1[strlen($date1)-2].$date1[strlen($date1)-1]; $dateexp=$jour . "/" . $mois . "/" . $annee; so it gives the right order in $dateexp : 25/02/1912
|
W
|
wildwally 3/2/2010 |
Any idea on how to not allow the user to pick a weekend? |
![]() |
ficcionista author 4/7/2010 |
Any idea on how to not allow the user to pick a weekend? Our site has a calandar that looks at a table for lead times and calculates earliest allowed date - but can't figure out how to not allow weekends to be selected.
$tomor = date("D"); What this does is check the week day. If we're on a Friday, Saturday or Sunday it will always add Monday's date. If we're on any other day of the week it will add tomorrow's date. $tomorrow = date("D"); |
W
|
wildwally 4/29/2010 |
I have something similar on one of my apps that fills out a date automatically based on the current date. What it does is filling out the date field with tomorrow's date every time you add one record, except on weekends. Here's the code: $tomor = date("D");if ($tomor == "Fri")$trw = date("Y-m-d", time()+259200);elseif ($tomor == "Sat")$trw = date("Y-m-d", time()+172800);else$trw = date("Y-m-d", time()+86400); What this does is check the week day. If we're on a Friday, Saturday or Sunday it will always add Monday's date. If we're on any other day of the week it will add tomorrow's date. $tomorrow = date("D");if ($tomorrow == "Sat" || $tomorrow == "Sun")echo "Sorry no weekends allowed;
|
O
|
oermops 9/18/2011 |
I don't want to sound dense here but can this be used to calculate multiple fields (if so how)? I have a total of 10 fields that I need to calculate, each with different times for the calculation. |
![]() |
ficcionista author 10/25/2011 |
I guess you could do something like this:
|