Calculating Days Only In This Week
i am trying to make a schedule based upon the current days of the week, then the rest falls in an archive. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Calculating Week Range
I am sure this has been asked before but it is difficult to search for. Given a date, is there a function or a already written script out there that will allow my to get the previous Monday before the date given? This is so that given the current date, I can show all events that are happening for that week. I also will want to do the same for the month. I know I could go about writing algorithms to calculate this, but I am sure this is something that has been done numerous times before. Also is there anywhere out there built an easy to plug in calendar view function that rather then my user manually entering the dates they want to select,can just select a particular date?
View Replies !
Calculating Start And Ending Dates For A Week
Given a week number, how do you derive the starting date and ending date? I am trying to get the reverse of the yearweek function of MySQL. The yearweek function returns the year and week given a date. For example, yearweek(񟭂-08-01') returns 200231.
View Replies !
Calculating Days Between Two Dates
I need to calculate the numbers of days (only the number of days) between two days, one a variable $row['user_cp_name'] in the format MM/DD/YY, and another, the current time. I've tried a bunch of tutorials on the internet and none seem to work properly.
View Replies !
Calculating The Number Of Days
I have a bit of a problem calculating the number of days chosen for a report. This is what I wrote: $start = mktime(0, 0, 0, $month1, $day1, $year1); $end = mktime(0, 0, 0, $month2, $day2, $year2); $days = (($end - $start)/(60*60*24)) + 1; where the values for $month1, $day1 etc. are selects in a form. The starting and end dates must be different. This seems to work mostly except for some cases e.g. Jan-01-2006 to May-01-2006 which gives me "120.95833333333 days". Any idea what I am missing?
View Replies !
Days Of Week
I'm attempting to display information for today, the next day and the day after (so only three days worth). The first day is hardcoded to say now. I want the next day and the day after to be the abbreviated day (ie. Tue, Wed and so on). The problem I have with the following code is that now and the next day are the same. Thus, I have now (which is Tue), the next day (which is ALSO Tues - wrong!) and the day after is Wed. Here's the include: $return['mydata'] = array(); for($i = 0; $i < 2; $i++) { $attr = explode('"', $this->tag('blm:mydata',$i)); if(count($attr) > 1) { $day = array(); $day['when'] = $attr[1]; $day['image'] = IMAGES.$this->translate($attr[11]).'.gif' array_push($return['mydata'], $day); } } return $return; And here's the front-end page: echo " ".$stuff['mydata'][0]['when']."<br/>
View Replies !
Days Of Week In App
recommend for a best approach to populating a Days-of-the-Week table in an event-scheduler app? in my particular case, each day of the week relates to a daily drink-special for a bar. i'm trying to figure out my order of dependencies. here's a snapshot of my tables if i am going to add an event,i have to have it on a day of the week. that day of the week needs to have it's specials populated in order for it to exist in the Table. so, how should i go about "forcing" the Event Scheduler App User to first populate the Days-of-Week table so that when she adds data for an event, the dayys of the week will be available to input into the Event table?
View Replies !
Calculating Days From NOW From Future Datestamps
Hi All,I have datestamps of the format 11202006 (November 20th 2006) in the DB. All these datestamps are of the future. With reference to the datestamp, I need to query the database for all entries that are 90, 60, 29, 28, 27, 26, ... 02, 01 days away from NOW. So, if there are entries with datestamps 90 days from NOW, they will need to be displayed.The query will be run everyday through a CRON script. How do I create the queries? Would there be multiple SELECT queries? Eg: 90, 60, 29 .. 02, 01
View Replies !
Constraint Using The Days Of The Week?
I am developing a property application where I have 5 members and only want 1 member a day to choose their property for the "property of week" section. So I want to assign a day to each member. Mem1 - Mondays Mem2 - Tues Mem3 - Wed etc.. Each member will have there own unique logon so if Mem1 logs in on Monday, they will have the "property of week" option avaliable to them. Mem2 will have it Tuesday and so on.
View Replies !
Display For The Week Of (fridays Date Of The Week).
I have a report that people can access online and it generates data for a given week until friday. In the title and on the report, I want to display For The Week Of (fridays date of the week). Instead of writing a huge if - then statement array - is it possible for to simply have an expression that figures out what day it is and then tells me Fridays date - has anyone ever done anything like this.
View Replies !
Calculating Age
Im trying to pull a date of birth from my database (mysql) and use this to calculate a users age for display on the page. At the moment i'm storing the date of birth of each user in three different INT fields in my table: Year - INT - 4 Day - INT - 2 Month - INT - 2 here is the code im trying to use to calculate the age: Code:
View Replies !
Calculating
when calculating i am trying to add to variables together like this but it not work why. $total = ($a+$b);
View Replies !
Calculating Tax
I have a the following tax table which shows tax calculations on wages. The way it works is that you find the row where your annual wage is between the lower and upper limits. Then the difference between your wage and the above column is multiplied by the rate. You then add the last column to your result.Code: Lower Upper Percent Above Also Add 0 2,650 0.0%00 2,650 10,120 10.0% 2,650 0 10,120 33,520 15.0% 10,120 747.00 33,520 77,075 25.0% 33,520 4,257.00 77,075 162,800 28.0% 77,075 15,145.75 162,800 351,650 33.0% 162,800 39,148.75 351,650 and over 35.0% 351,650 101,469.25 Note: Lower limit = last upper limit; above = last lower limit; also add = (last upper - lower)*last percent. Example: Say you earn 15,600 a year, you take: (15,600-10,120) * .15 + 747 = 1,569 how can you do this in PHP given these arrays:PHP Code: $LowerLimits = array(0,2650,10120,33520,77075,162800,351650);Â Â //must you have a 0? $Percents = array(0,.10,.15,.25,.28,.33,.35);
View Replies !
Calculating Colors
wondering if anyone has built or knows of a script out there that will calculate and output all of the websafe colors as hex values.
View Replies !
Calculating Duration
I'm trying to figure out how to calculate the duration when given 2 times. What I have is a script shown below in which you select a start time and end time from a drop down box, but would like some assistance on how to calculate the duration. An example: Start Time: 8:30 End Time: 9:30 Result: 1 Hour (60 mins) <tr> <td><b>Select Operation Start Time</b></td> <td><select name="start_time"> <option value="null">Select One</option> <? $start=mktime(8,30,0,date('m'),date('d'),date('Y')); for($i=$start;$i<=$start+32400;$i+=900) { $time=date("H:i",$i); echo "<option value=$time>$time</option>"; } ?> </select></td> </tr> <tr> <td><b>Select Operation End Time</b></td> <td><select name="end_time"> <option value="null">Select One</option> <? $start=mktime(8,30,0,date('m'),date('d'),date('Y')); for($i=$start;$i<=$start+32400;$i+=900) { $time=date("H:i",$i); echo "<option value=$time>$time</option>"; } ?> </select></td> </tr>
View Replies !
Calculating Tim - Easy For You! =)
I found out that i can calculate the dates e.g $today = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d"), date("Y"))); $yesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"))); $dayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 2, date("Y"))); $dayBeforeTheDayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 2, date("Y"))); and so on........ This works even if we have the 1st of August $yesterday gives me the 31st july. Can I do this with times also? e.g. Iit it now 17:06 an i want to make minus 20 min (like abopve minus 1 day) and I want the result to be 16:46. I tried the above example, wit %H%M but it does not work?
View Replies !
Calculating Distance
Does anyone know of a service or script where you can enter two addresses and get a distance between, or do so by range? I know mapquest has something, but I'm looking for something a little less expensive and basic? If anyone has any ideas, that would be great. BTW, it must work with PHP and MySQL
View Replies !
Calculating Checkboxes
I have made a form consisting of an array of seven checkboxes. I'm trying to figure out how to write a php script to calculate 1 dollar for every checkbox chosen.
View Replies !
Calculating With The COUNT
I am writing a simple banner management script with three tables: banner, impression & clickthrough. Banner has three columns: banner_id (pk), banner_name & banner_url Impressions has 4 columns: impression_id (pk), banner_id (fk), banner_timestamp & banner_domain. Clickthrough also has 4 columns: clickthrough_id (pk), banner_id (fk), clickthrough_timestamp & clickthrough_domain. Every time a banner is shown, a record is created in the impression db and whenever one is clicked, the clickthrough db is similarly added to. My problem comes when trying to use SQL to get the conversion rate for any particular banner. For each banner I need to count the total records in the impression db and then divide it by the count from the clickthrough db. But I cannot for the life of me work out how to get counts from two tables and perform a mathematical operation on them.
View Replies !
Calculating The Time
How would I estimate the time remaining to complete a loop if each run of the loop required a variable amount of time? For instance, if I run an array 5 elements in size that runs in a foreach loop where it took 30, 20, 53, 40, and 32 seconds each run of the loop, how could I output the estimated time until completion in seconds as the loop is running?
View Replies !
Calculating Birthdate By Given Age
I already have a method of calculating the age by a given birthdate, but I have no idea how to do that in reverse. Here's my method on calculating the age by given birthdate: <?php function calculate_age($month, $day, $year) { global $month, $day, $year; $time = time(); $new_date = mktime(0, 0, 0, $month, $day, $year); $age = ($new_date < 0) ? ($time + ($new_date * -1)) : $time - $new_date; $year = 60 * 60 * 24 * 365; $return_age = $age / $year; return floor($return_age); } ?> how do you reverse this process so it outputs the birthdate?
View Replies !
Error Calculating
I'm getting an error and I really don't know why. I get the values from a form page and I add all the values put, to get a subtotal. So far, so good. It adds perfectly. I then get this subtotal value and multiply it by 2.35 to give it a total. It works great as long as the subtotal is under 1000. I don't know why it doesn't work. This is the part of the code where it doesn't work as I would like it to. All this is supposed to do is give the value of dollars in a foreign coin. echo 'Dollars:$'.$totalamount."<br>";//this works $totalamount = $totalamount * 2.35; $totalamount = number_format($totalamount, 2); echo 'Reais:$'.$totalamount.'<br>'
View Replies !
Calculating Internet
I would like to calculate a viewer's internet connection speed when coming to a site. I've done a bunch of searches and came up with a few scripts that weren't that accurate when I tried them.
View Replies !
Calculating Timestamps
I have a mysql 3.23.58 server and php 4.2.2. I noticed that in mysql 3.23.58 when calculating a timestamp, lets say I am doing something like this in my sql. Code: select email from tbl_customer where date_added < current_timestamp and date_added > current_timestamp - 00000003000000; The date added field is actually a field that holds a time stamp. The zeros with the three represents three days before the current time stamp. I noticed that in mysql 3.23.58 it subtracts the days from 100 when the 2 digits in the timestamp that represent the month go to the previous month. In mysql 5 and newer the timestamp will calculate correctly.
View Replies !
Calculating Fields
This seems to be a simple request, But I could not find anything on the web of how to accomplish it. I have two drop down selection fields which I would like to be able to put a value on the "qty" field and the " level" field add together and show the result in the cost field on the output form. Code:
View Replies !
Calculating Time
I have 2 dates one is now and the other date I have output as 2007-04-18 02:05:22 2007-04-18 02:05:22 is the first date = $creationDate and $timestamp = time(); when i use $result = $timestamp - $creationDate; it out put time in 1176956379.
View Replies !
Calculating Mortgage APR
I've got this daunting task of calculating the APR of a mortgage, I've had a look at some JavaScript, and it looks very complex. This is what I have calculated, these are exmple figures Property value £250,000 Net Mortgage Advance £102,150 Total Mortgage Advance £102,150 Term 25 Years Total Amount Payable £205,960.81 Repayment type Repayment Basis of Rate Variable Rate Initial Interest Rate 6.45% Initial Rate Period 25 Years APR %.
View Replies !
Calculating My Wage
I would like to create a PHP-script where I can enter when I met at work, when I went home and how long a break I had. Then this should be multiplied with my hourly wage. For instance if I met at 10:00 am and left at 5:00 pm and had 1:00 hour break, my hourly wage would have to be multiplied with 6 hours. On monday-friday after 6:00 pm, on saturdays after 3:00 pm and on sundays I have an allowance which I would like to be added seperately. We could call them $eveall, $satall and $sunall (cause they are different). Finally I would like all this to be saved into a file and to be shown on my html-page with the script for each month from the 21th to the 20th (for instance should July be from June 21th to July 20th).
View Replies !
Calculating Free Space Available
Is there a way to tell how much space is remaining available for files? I'm working on a script that takes uploaded images and adds them to a database, but I'd like to check and make sure there's room for it first. I think there's probably going to be some type of issue with quotas, because that's how I found the problem. A user had uploaded a test version and got an error that a folder could not be created because of insufficient space remaining. And I know I could probably exec() out to df or something similar, but I would like it to work on Windows servers as well, so I'd prefer to keep it all in PHP code if possible.
View Replies !
CALCULATING Row Values To Get A Total
My problem is,, that i have a PHP script that displays a table the table has the following colums firstname,surname,boots,hospital,woolworths,br,other, total the firstname and surname are grabbed from the database when the page loads, what i want is for the user to enter values in the boxes under the colums boots,woolworths,hospital etc then when they click submit,the page is refreshed, data submited into the database, bu them redisplayed in the table the values are calucated and each user is then given a total number of hours worked at those places. im really stuck guys, havent a clue how to go about this. so an example would be F S boots Hospital woolworths other total JOE BLOGS 0.8 0.8 0.8 0.8 HELP me 0.1 0.5 0.5 0.5 submit is pressed, data entered into the database, then page redisplayed with the total column totaled up. F S boots Hospital woolworths other total JOE BLOGS 0.8 0.8 0.8 0.8 3.2 HELP me 0.1 0.5 0.5 0.5 1.6
View Replies !
Calculating CIDR Blocks
I have array of free IP addresses. One IP per line. Now I'm trying to share them to CIDR blocks /24 - /32. For example: if 1.1.1.0-1.1.1.255 is free, it returns array('.1.1.0/24') but let's say that 1.1.1.1 is used, then function should return array('.1.1.128/25', '.1.1.127/26', '.1.1.32/27', etc until free block doesn't fit). Here's my current code:
View Replies !
Calculating Future Dates
I have a variable ($today) that is simply $today = date("m/j/Y"); I want to get another variable for x months down the line, but using the php.net reference of the mktime and date command, my second date, as follows comes out in a large number. How can I make sure it is forwarding the date properly, and format it like mm/dd/yyyy? This is the line from php.net reference page. I need this to calculate properly, and format mm/dd/yyyy - just like my variable up top. $two_months_from_today = mktime(0,0,0,date("m")+2 ,date("d"),date("Y"));
View Replies !
Calculating A Few Numbers Via A Form...
I am trying to put up a script where users enter certain info into a form and after they enter the info in, they click submit and the script makes a certain calculation using those numbers. For instance, the form should look something like this: Name: Age: Height in inches: Weight in pounds: Shoe size: Then the script takes the 4 numbers inputted in the age, height, weight, and shoe size rows and does this calculation and shows the user the result: (Height + Weight) * Age) / Shoe Size
View Replies !
Calculating Correct Time
Lets start off by giving you my code (Well the important sections of it!): <?php /**/# Total Time /**/$query = "SELECT sum(hours) FROM flights ".$condition; /**/$result=mysql_query($query); /**/$blcktime = number_format(mysql_result($result,0)); /**/$query = "SELECT sum(minutes) FROM flights ".$condition; /**/$result=mysql_query($query); /**/$blckmins = number_format(mysql_result($result,0)); echo "$blcktime:$blckmins"; ?> Okay this part works. Like if there is an entry that has 20 hours in hours table and 50 minutes in minute table it displays 20:50, but my problem is if there are more than one record (Which there will be) if the previous was still true and another record had 1:30 the total would be 21:80 but this of course is not correct addition of time. And this is not a 24 hour clock it simply displays the time someones been in a game so it can go lke 300:56 too. Now how would I get it so if the $minutes were greater than 60 and divisible by 60 it would add the correct numbers to the hours like $hours = $hours + $times_divisible; or something like that! I am okay with if..else..elseif statements but that would take forever to write. thats why I need a looping sttatement but I havent got a clue how to write it.
View Replies !
Calculating Random Numbers?
I have an average. Everybody knows that the formula to find an average number is: x = (a + b + c + d) / 4 x being the average. Say I already have an average, like this: 95 = (a + b + c + d) / 4 How would I generate four random numbers added together, divided by four, to get an average that equals 95?
View Replies !
Calculating Page Bandwidth
I intend to use Ajax for a kiosk application, it's primary usage is to retrieve live data from my DB, it's a fairly small amount of data (5 fields, of small data size and limited to 15 rows). When I check my server logs I can see that the kiosk page has used a fair amount of bandwidth this month, this is obviously because a javascript timeout refreshes the data every 10 seconds. What I need to know is how to calculate the bandwidth of the data for every ten seconds and then I can do the math to work out usage hours * bandwidth per hour. This is probably a fairly simple task but I've never done it before.
View Replies !
Calculating High Numbers
I try to calculate a high number: 2^100 so I make it like that: pow(2, 100); My result is 1.26765060023E+30 How can I calculate with that value. Or do I have to replace that by my own.
View Replies !
Calculating Server Load
Has anyone had experience setting up Zend Studio Server Components in college environments where 100-200 developers may be hitting the debugging engine at the same time? Want to determine if the installation and loading will crash this development platform that a whole bunch of students and classes depend on.
View Replies !
Auto Calculating Fields
What i have there is my form, i would like to assign a value to each box or menu option and when it is selected, for it to automatically update the total field. I have tried javascript, unsuccessfully using "OnChange" functions. I know it can be done via php, i have seen it on other sites.
View Replies !
Calculating Date Differences
What's a good way to calculate the number of days between two dates in the following format: 2003-07-15 2003-08-02 I've looked at the PHP date functions but I'm still a bit lost.
View Replies !
Calculating Date Query
I've been asked to develop a script where it displays todays news according to today's date, and then to display news items 5 days prior to todays date. Interesting problem, I think. Basically all the news items are stored in a database itemid int(11) heading varchar(255) prop_date varchar(255) content text So I need to select heading according to todays date, then another select heading 5 days prior to todays date.
View Replies !
Calculating Time Function
I have to calculate with time and dates.Im searching to find a custom or php function that allows me to do this. it has t work somthing like this. Adding Time 2007-06-14 + 2 days = 2007-06-16 2007-06-31 + 2 days = 2007-07-02 2007-06-11 + 1 month = 2007-07-11 2007-06-11 + 1 year = 2008-06-11 ect.. Telling Difference 2007-06-14 ~ 2007-06-16 = 2 Days ect.. Deducting Time (-) Same story for Time (00:00:00)
View Replies !
Date - Calculating Periods
How would I get the next 2 week period (closest to current date). Periods - 1st - 15th each month, 16th - end of month. [php] $now = time(); $currentDate = date("Y-m-d H:i:s", $now); $previous_period = ? // Y-m-d H:i:s $next_period= ? // Y-m-d H:i:s [/php] example output would be: today = 21st August 2007 Prev Period = 15th August 2007 Next Period = 1st September
View Replies !
Day Of Week ?
Is there a way I can obtain the day of week - If I have the day, month, year ? (not via the time function - But from a database....) Im looking through the calendar and date functions -But can't locate anything suitable...
View Replies !
Day Of The Week?
is there a way to get the day of the week in php? i want to get the correct values monday, tuesday, wdenesday, etc. for the actual day it is.
View Replies !
Calculating Prices, Dollar Format?
I have some code which basically does some very simple addition and multiplication in order to get the total price. This is working fine, it's the way that it outputs it that troubles me. i.e 2.25 + 2.25 = $4.50 > but it just outputs it as $4.5 another example: 10 * 2 = $20.00 > but again it outputs it like $20 [ I need it to ouput like 20.00 but it does 20 instead. 6.5 instead of 6.50 etc. ] So say the total price is $total I was getting around it by just putting: $$total.00 but obviously with this it has to be a number like 10.00, 20.00 or 15.00 if it's 10.50 or 10.75 it doesn't work. In CF there is a 'dollar format' which can be used when outputting things like this. Is there a similar type function in PHP or an easy way around this?
View Replies !
|