Working With Dates - Set Up A Cron Job That Will Close All Auctions That Are 10 Days Old
I am writing a new auction script for my website and I have everything working except closing the auctions. I have the database set up to record the start time like this:
Field    Type     Default
time    datetime   0000-00-00 00:00:00
I want to set up a cron job that will close all auctions that are 10 days old. My only problem is I don't know how to write the code the find the 10 day cutoff. I know I need to somehow take today's day and subtract 10 days from it but I can't seem to find out how.
My plan is once I find that code I will then take that variable and compare it to the time in the database with >.
View Complete Forum Thread with Replies
Related Forum Messages:
Dates Of $day In The Next $n Days
how would I go about working out the dates (timestamps) of the day $day (e.g. Monday, Tuesday, &c) in the next $n days. So if $day was Monday and $n 28 I would want to find out the dates in the next 28 days that are a Monday. The problem is that I am not sure about the logic side of the problem. A crude solution that I can think up is doing something like PHP Code:
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 !
Number Of Days Between Two Dates
I have spent forever trying to figure this out.. There has to be a simple way. My dates are in the format m-d-y 06-22-07 I want to know the number of days between 05-23-07 and 06-22-07. this should equal 30. I am trying to figure out how to get that with PHP.
View Replies !
Retrieve Number Of Days Between Two Dates
I am trying to write a script that grabs todays date and then counts the number of days between today and a date in the future. Both the future date and the number of days interval are retrieved from a database (MySQL). PHP Code:
View Replies !
Dates - Detect Groups Of 7 Days
i'm developing a reservation system for a vacation house. the owner has specified that the place can only be rented by the week, check-in is on saturday, then check out must be on some following saturday (doesn't matter how many weeks as long as check-out is on a saturday). i tried to figure out if the user has selected spans of seven days (rented it for 1,2,3 weeks etc...) this way: PHP Code:
View Replies !
Calculate Number Of Days Between Two Dates
I have people posting ads and when the ad is posted I have two fields populated at that time: date_created date_expired With the date expired being 7 days after the date created. Both are in this format: 03/12/07 What I am doing is preventing someone from posting more than one ad per 7 days. I'm validating against their email address for that. But I want to display the date that they would be eligible as well as determine if they are eligible to post or not which would require comparing today's date with probably using the now() function against the date_expired in the database. If the today's date is past then no problem. If not, then it would display an error. Code:
View Replies !
Dates, Daylight Savings And Net Days Worked
I'm trying to mimic the functionality of netdaysworked in excel. The code below works, except when the date starts during daylight savings time. what is the number of seconds in a day for a daylight savings day? for ($dayval = $startdate; $dayval <=$enddate; $dayval+=$oneday){ if (date(I,$dayval)==0){ echo("daylight savings time<br>"); } if(date(w,$dayval)==0){ $daysworked = $daysworked+0; } elseif(date(w,$dayval)==6){ $daysworked = $daysworked+0; } else{ $daysworked++; } echo("first day: ".$dayval." number of days ".($dayval/86400)." lastday : ".$lastday."day of week :".date(w,$dayval)."date: ".date("m- d-Y",$dayval)." days worked: ".$daysworked."<br><br>"); }
View Replies !
How I Could Compare Two Dates To Find The Number Of Days That Seperate Them.
I was wondering how I could compare two dates to find the number of days that seperate them. For instance, after a user signs up to my website, they would see a specific message for only a week. Obviously this is easy if they signed up on the 14th and today is the 16th, but what about if they signed up on the 29th, then I need to figure out for the next month.
View Replies !
Working Days
I need to setup a script to run on the FIRST WORKING DAY of each month. I will have the script running as a cron. I was thinking the easiest way of doing this would be to have a bit of php inside the script that detects to see if the day is the first working day of the month and just run the cron every day.
View Replies !
Working Out Days Elapsed.
in mysql i have 2 files (date files) they are: 1)2007-08-27 13:20:03 2)August 13, 2007, 10:02 pm they are displayed differently, is there a way i can work out the days elapsed between them like this? or do the time stamps need to be the same?
View Replies !
Cron Not Working With Php+gd
I'm trying to run the following php code along with gd library as a cron job ,but cron is not generating any output. When I run this code from my browser I get an image correctly. Somebody please tell me what needs to be done to get an image via cron job. <?php //Header("Content-type: image/png"); $height = 300; $width = 300; $im = ImageCreate($width, $height); $bck = ImageColorAllocate($im, 10,110,100); $white = ImageColorAllocate($im, 255, 255, 255); ImageFill($im, 0, 0, $bck); ImageLine($im, 0, 0, $width, $height, $white); for($i=0;$i<=299;$i=$i+10) { ImageLine($im, 0, $i, $width, $height, $white); } ImagePNG($im,"x.png"); ?>
View Replies !
Cron Not Working When Calling Script With Mysql On Linux Box
I was referred to this forum as this may be a php specific problem. Some kind of configuration problem maybe. I have some php files that connect to a mysql database and are run as cron jobs. The scripts work fine when run via the command line as root, but when run via the cron they cause a mysql connection error. Call to undefined function: mysql_pconnect() I have found some info on this and tried many things but none of them are working. Does this have something to do with setting the appropriate environment in php script? I read something about that but am not sure how or what to do.
View Replies !
Working With 2 Dates
Two tables...debits and credits date field in each with dateTime format. I need to select all rows where user='$userID' and then print them to screen in a chronological order.
View Replies !
Working With Dates
I'm wanting to return all the data from my database for an exact date. My date field is a timestamp. Here is the code that I have been trying to use: select * from production where date like 񟭇-05-30' or select * from production where date = 񟭇-05-30'
View Replies !
Close All Child Windows When Close The Main Window
From the main page, there are lots of links to open new window. i.e. <a href="#" onClick="window.open('child1.html')">Open Child Window</a> If I close the main page, I want to close all child windows also. That means I need to keep track all handles of the child windows whenever I open a new window. Correct? any suggestions on the approach?
View Replies !
Working With Dates On The Modify Page
I have a column in a table called testimonialDate. It is of type 'date'. When trying to modify a record, I can get it to display nicely on the modify page using: $testDate = $testrow['testimonialDate']; $testDate2 = strtotime($testDate); $newdate=date("m-d-Y", $testDate2); then <?=$newdate?> However, when I change the displayed date and hit the modify button, it blanks out the testimonialDate column in the record selected. I've found a lot of hints on the internet for displaying, but how do I send the info back up? I'm also having issues trying to add a record. Typing in 3-3-2003 in text field results in 2003-3-20 in database. Can I get some hints or a link to a good tutorial?
View Replies !
Working With Dates In Hours Minutes Seconds ?
I have 2 dates in this format $timeold = date('m.d.y H:i:s', $timeold); $time2=(strtotime("now")); $time2 = date('m.d.y H:i:s', $time2); for example $timeold is 09.21.06 08:50:30 and $time2 is 09.21.06 09:00:38 When I make this $diff= $time2-$timeold; I receive this -608.21000003815 how can I transform this value (-608.21000003815) in hours minutes seconds ?
View Replies !
Working With Dates - Runs And Queries The Database To Produce A List Of Information
I have a script that runs and queries the database to produce a list of information, based on a date range. This is to fllow up on a script that is automatically run each Sunday night. What I want to try and acheive is, for example, if someone manually runs this report on a Tuesday the script will assume that it is run on the Sunday night, to make sure the results are exactly the same as the emails that have gone out. PHP Code:
View Replies !
Offering Dates And Booked Dates In A Table As DATE Datatype Using MYSQL.
Availability dates in offering dates except booked dates. For Example: Offering dates are : 01-09-2005 to 27-09-2005 01-11-2005 to 30-11-2005 Booked dates are : 10-09-2005 to 23-09-2005 Availability dates should be 01-09-2005 to 09-09-2005 24-09-2005 to 27-09-2005 01-11-2005 to 30-11-2005 I am storing offering dates and booked dates in a table as DATE datatype using MYSQL. So, I want the above mentioned availability dates as a result.
View Replies !
Showing "Today" "Yesterday" Working Dates
I've got a date field in mysql... i call it to my script using: echo date('m/d/Y @ g:i:s A',strtotime($row["newsDATE"])); where $row["newsDATE"] is the untouched mysql time stamp... what I'd like todo is be able to say: Today @ Time Yesterday @ Time 2 Days Ago @ Time Date @ Time as my posts age..
View Replies !
Dates In Range Falling Between Existing Dates
The latest quandry I have is that I need to: a: check whether any dates in a date range entered by a client in a form (datefrom, dateto) conflict with any existing date ranges already in the database. -this is a check to see whether the dates that a customer is trying to book are not already booked- Obviously its easy to get the numbers out of the database (i.e. 28/12/2006 or whatever format) and from the form but how to I convert this 'range' actually into a range I can loop through that will return true if any of the dates are the same (i.e. already booked)? b: is similar in that I want to check how many of the clients entered dates fall into the pre assigned high, mid and low season ranges in the database and multiply each of those days by the corresponding price.
View Replies !
On Close
In php is there a method for that can be used when a user closes the browser? I want to set a variable when the user closes the window.
View Replies !
Close After Date.
i have a page that after the 25th of the month i dont want people to access. using Date is this possible? i had one for certain days but it didnt work out: <?php $d=date("D"); if ($d=="Thu" || $d=="Sat" || $d=="Sun" || $d=="Mon" || $d=="Wed") { exit; }else{?> <?php } ?>
View Replies !
Close Window
how can I close a browser window after php read the last row? I have tryed with exit; extit() header("Connection: close"); ..
View Replies !
How To Close Table
As I wrote few weeks ago, I'm not programer, but I have to create one script. that is a gallery script, and after successful work on flatfile gallery script I'w decided to build mysql script. frontend is almost done, everything is working fine, except ending of tables.. Code:
View Replies !
Not Sure Where To Close The Table At...
Im trying to get the line "Are you sure you want to delete this picture?" to display below the picture the mysql query brings back, but for some reason that line of code keeps appearing above the picture all smashed together (like it is located in a cell of a table) my guess is that I do not have a table closed right but who knows....any ideas? Code:
View Replies !
Close Browser
In my login system, i want the user to properly log out when you close the browser. I can end all sessions, as they get deleted anyway, but i want it to change the users logeed in bit. This works by whenever a user logs in, it sends a query to a database and updates a table, then the users online box reads it and displays it. What happens is, the user closes the browser and the table stays the same. So it appers as the users is online but he actually isnt.
View Replies !
Close The Table
flush(), ob_flush() doesn't work, not enough security rights to run MySQL CMD FLUSH TABLES or even FLUSH TABLE tablename Is there a way to close the table after you query it? mysql_free_result doesn't close the table. Would like to find a solution i hate seeing red in the syslog in mysql php ver 4.3 and 5 mysql ver5.0.24a.
View Replies !
Close A Window Automaticaly
Is there a way to close a window automaticaly with PHP. The case is: I have a form, and when someone clicks on the first option, en then submits, a form is printed, if one chooses the other option, the window should close .. is that possible ?
View Replies !
How Do You Disable The Close (x) On A Window
I'm running a PHP script on page1.php that takes a few seconds, once it has run the page then redirects to page2.php automatically sending variables . However, if the user shuts page1.php by pressing the X on the top right of the screen, the redirect doesn't happen!! Does anyone know how to disable the X and stop the page being closed down please?? or another solution??
View Replies !
Function On Page Close
How do i setup a timestamp that rights to mysql on website page close? Can i add a function based on page closure or do i have to add a session time out mechanism?
View Replies !
How Important Is It To Close A DB Connection?
How important is it to close a DB connection? I accidentally forgot to do it in some pages and did in others, does this matter? Which leads to another thing, I've read tutorials/examples which close it like this: mysql_close(); whilst others use the connection string mysql_close($connection);. Which is better/does it matter?
View Replies !
Auto-Close Tags?
No, not PHP or HTML or whatever. BBCode. What I want to know, is whether PHP can go through a written piece of text, count the number of times something is entered (say, ), and the number of times something else is entered (). Then, if there are more of the first than the second, keep adding the second one on the end until they're equal. Alternatively, is there a way to allow bbc to be used, but if a tag isn't closed, it won't affect the rest of the page?
View Replies !
Close When No Data Has Been Entered
I just started learning PHP a couple of days ago and right now I'm writing a script to insert tutorials into a database. Everything works fine, except that when someone visits "insert.php" it enters empty fields into the database, while it shouldn't enter anything. And when someone refreshes the page after submitting, the data will be entered again. Code:
View Replies !
|