Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg
$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

Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg
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

2007-07-02 Thread Dan
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

Re: [PHP] Date Calculation Help

2007-07-02 Thread Richard Lynch
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

[PHP] Date Calculation Help

2007-06-30 Thread revDAVE
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

Re: [PHP] Date Calculation Help

2007-06-30 Thread Paul Novitski
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

[PHP] Date calculation

2006-10-15 Thread Ron Piggott (PHP)
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

Re: [PHP] Date calculation

2006-10-15 Thread Travis Doherty
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

Re: [PHP] Date Calculation

2004-10-29 Thread Robert Sossomon
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? ?php // current time at start of script $before = strtotime(now); //All your DB stuff { } // current time at end of script $after =

Re: [PHP] Date Calculation

2004-10-28 Thread Mike Tuller
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

RE: [PHP] Date Calculation

2004-10-28 Thread Jay Blanchard
[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

[PHP] Date Calculation

2004-10-28 Thread Mike Tuller
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

RE: [PHP] Date Calculation

2004-10-28 Thread Jay Blanchard
[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

Re: [PHP] Date Calculation

2004-10-28 Thread Mike Tuller
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

Re: [PHP] Date Calculation

2004-10-28 Thread Tom Rogers
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

Re: [PHP] Date Calculation

2004-10-28 Thread Mike Tuller
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. ? $database_name = CETechnology; $host = server; $login = username; $password = password; $ethernet_address = 00:01:93:8e:69:50; $db_connect = mysql_connect( $host, $login,

Re: [PHP] Date Calculation

2004-10-28 Thread Jennifer Goodie
-- 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

Re[2]: [PHP] Date Calculation

2004-10-28 Thread Tom Rogers
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 ? MT $database_name = CETechnology; MT $host = server; MT $login = username; MT $password = password; MT

[PHP] date calculation

2003-02-16 Thread qt
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

2003-02-16 Thread Kevin Waterson
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 --

Re: [PHP] date calculation

2003-02-16 Thread qt
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

Re: [PHP] date calculation

2003-02-16 Thread Stephen Willcock
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 =

Re: [PHP] date calculation

2003-02-16 Thread qt
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]...

Re: [PHP] date calculation

2003-02-16 Thread Stephen Willcock
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

[PHP] date calculation

2001-05-04 Thread Gary
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

Re: [PHP] date calculation

2001-05-04 Thread James Holloway
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