Re: [PHP] Date Calculation Help
If the date is coming from a database, there might be a function/format already for that... And http://php.net/date may also have a format specifier for Quarter. If not, try this: $quarter = ((int) ($month / 4)) + 1; On Sat, June 30, 2007 10:14 am, revDAVE wrote: > I have segmented a year into four quarters (3 months each) > > nowdate = the month of the chosen date (ex: 5-30-07 = month 5) > > Q: What is the best way to calculate which quarter (1-2-3 or 4) the > chosen > date falls on? > > Result - Ex: 5-30-07 = month 5 and should fall in quarter 2 > > > > -- > Thanks - RevDave > [EMAIL PROTECTED] > [db-lists] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation Help
Well then after or before that you have to check that the month value is between 1 and 12 to make sure there's no input errors, then what if you ever want ot change the quarters yeah anway I just wanted an excuse to tell people to go low tech and use a switch, it's only 12 entries, and you could set a default. - Dan "Fredrik Thunberg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] of course ceil( month / 3 ); -- /Thunis Don't panic. --The Hitchikers Guide to the Galaxy Fredrik Thunberg skrev: $q = ceil( month / 4 ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation Help
of course ceil( month / 3 ); -- /Thunis Don't panic. --The Hitchikers Guide to the Galaxy Fredrik Thunberg skrev: $q = ceil( month / 4 ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation Help
$q = ceil( month / 4 ); -- /Thunis The ships hung in the sky in much the same way that bricks don't. --The Hitchikers Guide to the Galaxy revDAVE skrev: I have segmented a year into four quarters (3 months each) nowdate = the month of the chosen date (ex: 5-30-07 = month 5) Q: What is the best way to calculate which quarter (1-2-3 or 4) the chosen date falls on? Result - Ex: 5-30-07 = month 5 and should fall in quarter 2 -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation Help
At 6/30/2007 08:14 AM, revDAVE wrote: I have segmented a year into four quarters (3 months each) nowdate = the month of the chosen date (ex: 5-30-07 = month 5) Q: What is the best way to calculate which quarter (1-2-3 or 4) the chosen date falls on? Result - Ex: 5-30-07 = month 5 and should fall in quarter 2 If you divide the month number by 3 you get: 1 0.3 2 0.7 3 1 4 1.3 5 1.7 6 2 7 2.3 8 2.7 9 3 10 3.3 11 3.7 12 4 The first digit is off by one, so subtract .1 from each result: 1 0.2 2 0.56667 3 0.9 4 1.2 5 1.56667 6 1.9 etc. Now you can see from the first digit that if you take the integer value and add 1 you'll get: 1 1 2 1 3 1 4 2 5 2 6 2 etc. In PHP this could be: intval(($month - .1)/3 + 1) or: intval(($month + .9)/3) I believe you can use intval() and floor() interchangeably in this circumstance. Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Calculation Help
I have segmented a year into four quarters (3 months each) nowdate = the month of the chosen date (ex: 5-30-07 = month 5) Q: What is the best way to calculate which quarter (1-2-3 or 4) the chosen date falls on? Result - Ex: 5-30-07 = month 5 and should fall in quarter 2 -- Thanks - RevDave [EMAIL PROTECTED] [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date calculation
Ron Piggott (PHP) wrote: >I have one more date based question. > >I have a month field ( $month ) and a day field ( $day ) being submitted >by a form. > >I have a third field to be used as a date reminder for the information >which was submitted as part of the form. It is a reminder to complete a >task for the date was which was submitted as part of the form. > >How do I calculate the $reminder date based on $month and $day and have >it output in the -MM-DD format? $reminder is the number of days >before $month $day (I want to use $reminder in a date format to SELECT >records from a mySQL table) This is why I am wanting put $reminder into >a date format > >If $month was 6 and $day was 7 and $reminder was 6 then I would want the >output to be 2007-06-01 --- We have already passed June 1st in 2006. >However if $month was 11 then I would want the output to use this years >date --- 2006-11-01 > >Any suggestions? > >Ron > > > I think it would be easier to ask the user to enter his reminder in the standard date format of -mm-dd and use a JavaScript date picker box to prompt for it. Anyway, you could do something like this: $reminderStamp = strtotime("+{$addMonths} months",time()); $reminderStamp = strtoTime("+{$addDays} days",$reminderStamp); $date = date("Y-m-d",$reminderStamp); $date should have a string like -mm-dd that is $addMonths and $addDays into the future. I didn't test this. Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date calculation
I have one more date based question. I have a month field ( $month ) and a day field ( $day ) being submitted by a form. I have a third field to be used as a date reminder for the information which was submitted as part of the form. It is a reminder to complete a task for the date was which was submitted as part of the form. How do I calculate the $reminder date based on $month and $day and have it output in the -MM-DD format? $reminder is the number of days before $month $day (I want to use $reminder in a date format to SELECT records from a mySQL table) This is why I am wanting put $reminder into a date format If $month was 6 and $day was 7 and $reminder was 6 then I would want the output to be 2007-06-01 --- We have already passed June 1st in 2006. However if $month was 11 then I would want the output to use this years date --- 2006-11-01 Any suggestions? Ron
Re: [PHP] Date Calculation
Wouldn't just making the script get 2 time stamps be more efficient, since you are creating the database calls anyways? Or am I over simplifying it? // current time at start of script $before = strtotime("now"); //All your DB stuff { } // current time at end of script $after = strtotime("now"); $timed = ($after - $before); echo 'Time for script to execute: ' . $timed .' seconds'; ?> Robert Mike Tuller is quoted as saying on 10/28/2004 5:19 PM: Ok, so here is what I have. Please check to see if there is a better way. There are a lot of database calls to me. -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Date Calculation
Hi, Friday, October 29, 2004, 7:19:09 AM, you wrote: MT> Ok, so here is what I have. Please check to see if there is a better MT> way. There are a lot of database calls to me. MT> $database_name = "CETechnology"; MT> $host = "server"; MT> $login = "username"; MT> $password = "password"; MT> $ethernet_address = "00:01:93:8e:69:50"; MT> $db_connect = mysql_connect( $host, $login, $password ) or die MT> (mysql_error()); MT> $db_select = mysql_select_db($database_name) or die (mysql_error()); MT> $query = "SELECT * FROM hardware_assets WHERE ethernet_address = MT> '$ethernet_address'"; MT> $result = mysql_query($query, $db_connect) or die (mysql_error()); MT> while ($row = mysql_fetch_array( $result )) MT> { MT> $timestamp = $row["script_ran"]; MT> $timequery = "SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - MT> UNIX_TIMESTAMP('$timestamp')) as diff"; MT> $timeresult = mysql_query($timequery, $db_connect) or die MT> (mysql_error()); MT> $time = mysql_result($timeresult, 0, 0); MT> $secondquery = "SELECT TIME_TO_SEC('$time')"; MT> $secondresult = mysql_query($secondquery, $db_connect) or die MT> (mysql_error()); MT> $seconds = mysql_result($secondresult, 0, 0); MT> echo $seconds; MT> } ?>> MT> This returns the seconds since the timestamp was set for the row where MT> the ethernet address of the computer is equal to $ethernet_address. I MT> can then do the math so that I can display the hours or minutes. I can MT> even have it so that when the time is too long, it displays in red, or MT> bold, or whatever I want. Do it in one hit :)timediff comes out in hours:minutes:seconds $query = " SELECT *, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran) as seconds, SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran)) as timediff FROM hardware_assets WHERE ethernet_address = '$ethernet_address'"; $result = mysql_query($query, $db_connect) or die (mysql_error()); while ($row = mysql_fetch_array( $result )){ $seconds = $row["seconds"]; $timediff = $row["timediff"]; echo "$seconds = $timediff "; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
-- Original message from Mike Tuller <[EMAIL PROTECTED]>: -- > Ok, so here is what I have. Please check to see if there is a better > way. There are a lot of database calls to me. There are. Do it in one query. > > $query = "SELECT * FROM hardware_assets WHERE ethernet_address = > '$ethernet_address'"; > $result = mysql_query($query, $db_connect) or die (mysql_error()); > > while ($row = mysql_fetch_array( $result )) > { > $timestamp = $row["script_ran"]; > $timequery = "SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - > UNIX_TIMESTAMP('$timestamp')) as diff"; > $timeresult = mysql_query($timequery, $db_connect) or die > (mysql_error()); > $time = mysql_result($timeresult, 0, 0); > > $secondquery = "SELECT TIME_TO_SEC('$time')"; > $secondresult = mysql_query($secondquery, $db_connect) or die > (mysql_error()); > $seconds = mysql_result($secondresult, 0, 0); > > echo $seconds; > } > I don't know why you're doing both TIME_TO_SEC and SEC_TO_TIME, so I'm leaving them out as they are inverses. But I'm sure you can figure out what you want. $query = "SELECT *, (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran)) as seconds FROM hardware_assets WHERE ethernet_address = '$ethernet_address'"; This will return all the columns from the matching rows, plus an extra field called seconds that is the difference in seconds between now and wehn the script ran. Here is the list of mysql date/time functions for refernece http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1454 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
Ok, so here is what I have. Please check to see if there is a better way. There are a lot of database calls to me. $ethernet_address = "00:01:93:8e:69:50"; $db_connect = mysql_connect( $host, $login, $password ) or die (mysql_error()); $db_select = mysql_select_db($database_name) or die (mysql_error()); $query = "SELECT * FROM hardware_assets WHERE ethernet_address = '$ethernet_address'"; $result = mysql_query($query, $db_connect) or die (mysql_error()); while ($row = mysql_fetch_array( $result )) { $timestamp = $row["script_ran"]; $timequery = "SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('$timestamp')) as diff"; $timeresult = mysql_query($timequery, $db_connect) or die (mysql_error()); $time = mysql_result($timeresult, 0, 0); $secondquery = "SELECT TIME_TO_SEC('$time')"; $secondresult = mysql_query($secondquery, $db_connect) or die (mysql_error()); $seconds = mysql_result($secondresult, 0, 0); echo $seconds; } ?> This returns the seconds since the timestamp was set for the row where the ethernet address of the computer is equal to $ethernet_address. I can then do the math so that I can display the hours or minutes. I can even have it so that when the time is too long, it displays in red, or bold, or whatever I want. On Oct 28, 2004, at 3:14 PM, Tom Rogers wrote: Hi, Friday, October 29, 2004, 4:51:20 AM, you wrote: MT> I have a shell script that inserts the unix date and time that the MT> script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT MT> 2004. I would like to have my web page do the math so that it displays MT> the time since the script ran. How can I do the math so that the web MT> page will display something like the script ran 1500 seconds ago. MT> Thanks, MT> mike You can do something like this (replace date with column name no quotes) $result = mysql_query("SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('2004-10-01 13:45:00')) as diff"); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
Hi, Friday, October 29, 2004, 4:51:20 AM, you wrote: MT> I have a shell script that inserts the unix date and time that the MT> script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT MT> 2004. I would like to have my web page do the math so that it displays MT> the time since the script ran. How can I do the math so that the web MT> page will display something like the script ran 1500 seconds ago. MT> Thanks, MT> mike You can do something like this (replace date with column name no quotes) $result = mysql_query("SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('2004-10-01 13:45:00')) as diff"); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
I guess. Are you telling me that I should take the timestamp, convert it to epoch time, the us the time function to get the current epoch time, then subtract the timestamp epoch time from the current epoch time? I think that is what you are saying. I know I can get the current epoch time in php with time(). How do I convert the timestamp in the database to epoch time, or find the epoch time in bash? If I can't do it in either, then I am subtracting apples from oranges. On Oct 28, 2004, at 2:32 PM, Jay Blanchard wrote: [snip] That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. [/snip] You can use that to convert your time in the DB, get the current time when seeking as epoch time, subtract one from the otherno? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Calculation
[snip] I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. [/snip] http://us2.php.net/manual/en/function.strtotime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Calculation
I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. Thanks, mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Calculation
[snip] That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. [/snip] You can use that to convert your time in the DB, get the current time when seeking as epoch time, subtract one from the otherno? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. I would like to compare the date and time of timestamp in the database to the current time and come up with the difference in seconds. Then I could show on the web page that the script was run x many seconds ago. From that I could do the calculations to show that it was x minutes, xhours, etc. On Oct 28, 2004, at 1:52 PM, Jay Blanchard wrote: [snip] I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. [/snip] http://us2.php.net/manual/en/function.strtotime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
Yes, will be OK with all dates (though the valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.) The function you want for numeric dates is: int mktime ( int hour, int minute, int second, int month, int day, int year) so, in your example (1st Feb 2003): $mydate = mktime(0,0,0,2,1,2003); SW "Qt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Dear Stephen, > > Good clue!! > > Is it working allways without problem such as 29 feb? > > And one more hel how can I write "1 2 2003" instead of "1 february 2003" > > I wrote but directly but doesn' t work > > thanks > > "Stephen Willcock" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Try: > > > > $today = strtotime ("1 february 2003"); > > $enddate = strtotime ("2 february 2003"); > > $diff = $enddate - $today; > > > > Should give you a clue! > > > > SW > > > > > > "Qt" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Dear Kevin, > > > > > > I used timestamp allready as following; > > > > > > $today = strtotime ("1 february 2003"); > > > $enddate = strtotime ("1 march 2003"); > > > > > > $diff = $enddate - $today; > > > > > > But result comes as > > > > > > 2419200 > > > > > > How can I convert that numbers to days > > > > > > Best Regards > > > > > > > > > > > > "Kevin Waterson" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > This one time, at band camp, > > > > "qt" <[EMAIL PROTECTED]> wrote: > > > > > > > > > Dear Sirs, > > > > > > > > > > How can I add or subtract two date easily. Is therea any lib or > > function > > > > > about this. I can not find any easy way in the manual > > > > > > > > if the dates are timestamps, simply > > > > > > > > $new = $timestamp2 - $timestamp1; > > > > > > > > cheers > > > > Kevin > > > > > > > > -- > > > > __ > > > > (_ \ > > > > _) ) > > > > | / / _ ) / _ | / ___) / _ ) > > > > | | ( (/ / ( ( | |( (___ ( (/ / > > > > |_| \) \_||_| \) \) > > > > Kevin Waterson > > > > Port Macquarie, Australia > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
Dear Stephen, Good clue!! Is it working allways without problem such as 29 feb? And one more hel how can I write "1 2 2003" instead of "1 february 2003" I wrote but directly but doesn' t work thanks "Stephen Willcock" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Try: > > $today = strtotime ("1 february 2003"); > $enddate = strtotime ("2 february 2003"); > $diff = $enddate - $today; > > Should give you a clue! > > SW > > > "Qt" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Dear Kevin, > > > > I used timestamp allready as following; > > > > $today = strtotime ("1 february 2003"); > > $enddate = strtotime ("1 march 2003"); > > > > $diff = $enddate - $today; > > > > But result comes as > > > > 2419200 > > > > How can I convert that numbers to days > > > > Best Regards > > > > > > > > "Kevin Waterson" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > This one time, at band camp, > > > "qt" <[EMAIL PROTECTED]> wrote: > > > > > > > Dear Sirs, > > > > > > > > How can I add or subtract two date easily. Is therea any lib or > function > > > > about this. I can not find any easy way in the manual > > > > > > if the dates are timestamps, simply > > > > > > $new = $timestamp2 - $timestamp1; > > > > > > cheers > > > Kevin > > > > > > -- > > > __ > > > (_ \ > > > _) ) > > > | / / _ ) / _ | / ___) / _ ) > > > | | ( (/ / ( ( | |( (___ ( (/ / > > > |_| \) \_||_| \) \) > > > Kevin Waterson > > > Port Macquarie, Australia > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
Try: $today = strtotime ("1 february 2003"); $enddate = strtotime ("2 february 2003"); $diff = $enddate - $today; Should give you a clue! SW "Qt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Dear Kevin, > > I used timestamp allready as following; > > $today = strtotime ("1 february 2003"); > $enddate = strtotime ("1 march 2003"); > > $diff = $enddate - $today; > > But result comes as > > 2419200 > > How can I convert that numbers to days > > Best Regards > > > > "Kevin Waterson" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > This one time, at band camp, > > "qt" <[EMAIL PROTECTED]> wrote: > > > > > Dear Sirs, > > > > > > How can I add or subtract two date easily. Is therea any lib or function > > > about this. I can not find any easy way in the manual > > > > if the dates are timestamps, simply > > > > $new = $timestamp2 - $timestamp1; > > > > cheers > > Kevin > > > > -- > > __ > > (_ \ > > _) ) > > | / / _ ) / _ | / ___) / _ ) > > | | ( (/ / ( ( | |( (___ ( (/ / > > |_| \) \_||_| \) \) > > Kevin Waterson > > Port Macquarie, Australia > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
Dear Kevin, I used timestamp allready as following; $today = strtotime ("1 february 2003"); $enddate = strtotime ("1 march 2003"); $diff = $enddate - $today; But result comes as 2419200 How can I convert that numbers to days Best Regards "Kevin Waterson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This one time, at band camp, > "qt" <[EMAIL PROTECTED]> wrote: > > > Dear Sirs, > > > > How can I add or subtract two date easily. Is therea any lib or function > > about this. I can not find any easy way in the manual > > if the dates are timestamps, simply > > $new = $timestamp2 - $timestamp1; > > cheers > Kevin > > -- > __ > (_ \ > _) ) > | / / _ ) / _ | / ___) / _ ) > | | ( (/ / ( ( | |( (___ ( (/ / > |_| \) \_||_| \) \) > Kevin Waterson > Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
This one time, at band camp, "qt" <[EMAIL PROTECTED]> wrote: > Dear Sirs, > > How can I add or subtract two date easily. Is therea any lib or function > about this. I can not find any easy way in the manual if the dates are timestamps, simply $new = $timestamp2 - $timestamp1; cheers Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date calculation
Dear Sirs, How can I add or subtract two date easily. Is therea any lib or function about this. I can not find any easy way in the manual Best Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date calculation
Gary, Yes. Check the manual for mktime(); and getdate(); http://www.php.net/quickref.php James > Is there a way to do calculations with dates? Preferably ignoring weekends. > > Thanks, Gary > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] date calculation
Is there a way to do calculations with dates? Preferably ignoring weekends. Thanks, Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]