Search the Community
Showing results for tags 'date'.
-
Hi everyone, I am working on a site, that will allow dentist, doctors and the like to set up automated E-Mail reminders for their clients, instead of having to call them. I am relatively comfortable in php. But I have never done anything with E-Mail before... My main question has to do with sending E-Mail on a specific date. I have seen a few ways to do it, but nothing that really seems desirable. One way, seemed to require that someone be using the site, to send the E-mail. Ie: if an E- mail is supposed to be sent at 6, but no one logs on until 7:30. Then that E-mail won't be sent until 7:30. The other method that I have seen used cron, this second method, seems superior but much more complicated. What method should I use??? Any, hits/tips to get me on the right direction would be appreciated! Thanks, Josh
-
Hi, I wonder if someone can help me... I am trying to extract the date into three different variables ready to go into three option boxes for the user to update a person's date of birth. I am using the following to split up the day, month and year: $queryDate = mysql_query("SELECT YEAR(playerDOB), MONTH(playerDOB), DAY(playerDOB) FROM player WHERE playerID='$playerID'") or die (mysql_error()); Now I have tried this within the database and can see that it splits it up. The problem I am having is being able to access them in variables. How do I go about accessing the year, day and month separately from the $queryDate variable? Appreciate the help in advance!
-
First time poster so please take it easy on me. I am developing on a windows 7 machine with WAMP Server running and no configuration changes from the defaults. IIS is turned off. In my site I have a class method to record actions taken by the user. During this method I obtain a timestamp in unix and save it to the database. On the Dev machine, this works fine but when I put it online I get an error. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. I traced the issue through the code to this point: // get date stamp $date = date_create(); $datestamp = date_timestamp_get($date); // ERROR HAPPENS HERE I have tried this method and the OOP method and works fine locally, but fails on my full server which is a windows server running IIS. I have painstakenly checked the PHPINFO.php for discrepancies but can't see anything that would affect this setting - any help would be really appreciated. Kind Regards Michael
-
A little background on the project I'm working on: I have a reasonably large number of values, over 500k rows worth. The values are generated per hour, per parent. I want to group these values by one of four time intervals: Month, week, day or hour, and get the average for this period. The challenge comes by the fact that I need to split the values into two different blocks, based upon whether the value was generated during the "day" or "night/weekend". So far I've come up with two different approaches to this: Have two fields in the table for saving the values, one for the "daytime" values and the other for "night time/weekend" values. This would allow me to run separate functions on the fields, without involving the date functions in MySQL. At the cost of having two fields for what is essentially the same type of data, and having to do the splitting in the pre-insert phase. Save all values in the same field, and then use MySQL's datetime functions with a CASE-WHEN to figure out in which block they belong. This approach seems to be the cleanest one in terms of database-design, but I fear it will put a lot of strain on the database. Especially since the SELECT statements will run more often than the insertion script. So the question is if I should go for the first approach, the second, or if there is some other solution to this that I've failed to grasp? I could really do with some expert help on this one. Example values: Desired output:
-
So, basically, I have it set up so that banned users are in a table in the database called "bans". The lift date is formatted like such.. "02/14/2013 14:06AM" How can I make it so that if the date is passed, it removes the row from the table? Like how do I set up if($lift_date >= $c_date){ //remove } when using the time of day too?
-
Hello! This is my first time here and I'm not sure if this is where I should be posting this, but I want to delete all this info on a post: Date, Author, Categories, Bookmark permalink. How do I do that? Thank you! The website and post example is the following: http://www.emilykimballart.com/a-few-details/
- 2 replies
-
- posts info
- date
-
(and 2 more)
Tagged with:
-
Hello... I'm trying to calculate the next four Mondays, Tuesdays and Thursdays and stick each result in a select statement. So far, the best I have gotten is each date for Monday in four separate pulldowns: for($i=1; $i<=4; $i++){ echo "<select><option>"; echo date("Y-m-d", strtotime('+'.$i.' Monday')).'<br>'; echo "</select>"; } I guess the question is twofold. How do I get all of the dates in one pulldown and should I do three separate FOR statements to do it? Thanks, in advance!
-
Hello I have some serious date and time problem and i am working on it for 3 days without any hope. On my current job day change at 07:00 and i cannot calculate to see if person working or not if his job end after 00:00 My current code work fine if current time until 07:00am but fail after it. // Find end hour $working_hour = explode("~", "10:00~01:30"); // Explode it to hour and minute $ending = explode(":", $working_hour[1]); $mid = ($working_hour[1] > "07:00" && $working_hour[1] < "23:59") ? 1 : 0; $end_hour = mktime($ending[0], $ending[1], 0, date("n"), date("d") - $mid, date("Y")); $current = mktime(date("H"), date("i"), 0, date("n"), date("d"), date("Y")); // Return result if($end_hour < $current) return "-"; else if($row['left_min'] > 0) return "You have " .$row['left_min'] ." minutes left"; else return "you are done"; However; yesterday i wrote some code which works perfect for single count but fail in loop. Here it is; $array_for_hour = array(); $working_hour = explode("~", "10:00~01:30"); // if job end after midnight if($working_hour[1] > "23:59" || $working_hour[1] > "00:00") { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime("23:59"); // Add into array every 30 minutes for($i = $start_hour; $i <= $end_hour; $i += 1800) { $array_for_hour = $i; } // Add another 30 minutes to comlete to 00:00 array_push($array_for_hour, $i); $midnight_start = strtotime("00:30"); $midnight_end = strtotime($working_hour[1]); // Add hours into array from midnight to actual end hour for($i = $midnight_start; $i <= $midnight_end; $i += 1800) { $array_for_hour = $i; } } else { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime($this->bitis_saat); if($end_hour == "00:00") $end_hour = "23:59"; for($i = $start_hour; $i <= $end_hour; $i += 1800) { $this->arr[] = $i; } if($end_hour == "00:00") array_push($array_for_hour, $i); } Thanks for any help and advise. Regards
-
Hi PHP expert, I am trying to read the post date from my tumblr api with the following code. $date = $xml->posts->post ['date']; echo '<p>'.$date.'</p>'; This is what I get from the above code "Wed, 21 Nov 2012 13:32:00" My question is, are there anyways I can get the date with out the hour, min and seconds? for example "Wed,21 Nov 2012"?
-
I have the following code and cannot get my select statement to read the user input. It works if I hard code the date in the select statement - can someone please advise what I am doing wrong. Thanks. I am trying to get the month, day and year into 1 variable to match reserveDate in the database and then time is a variable by itself. <?php include_once 'helpers.inc.php'; ?> <? $date=$_POST['date']; if(isset($date) and $date=="submit"){ $month=mysql_real_escape_string($_POST['Month']); $day=mysql_real_escape_string($_POST['Day']); $year=mysql_real_escape_string($_POST['Year']); $reserveStartTime=mysql_real_escape_string($_POST['Time']); $reserveDate="$month$day$year"; echo "mmddyyyy format :$reserveDate<br>"; $reserveDate="$year$month$day"; echo "YYYYmmdd format :$reserveDate<br>"; echo "$reserveStartTime"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR...ransitional.dtd[/url]"> <html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Court Reservation Search</title> <style type="text/css"> #form1 center { text-align: center; } #form1 p { text-align: center; font-family: Verdana, Geneva, sans-serif; } </style> <h1>Court Reservation Search</h1> <body> <form id="form1" name="search" method="post" action="reservations.php"> <p> </p> <p class="text">Please select a date and time to make a reservation:</p> <p> </p> <p> <label for="Month"><span class="text"><span class="text"><span class="text"><span class="text"><span class="text">Month</span>:</span></span></span></span></label> <span class="text"> <select name="Month"size="1" id="Month"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <label for="Day">Day:</label> <select name="Day" id="Day"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="3">30</option> <option value="31">31</option> </option> </select> <label for="Year">Year:</label> <select name="Year" id="Year"> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> </select> <label for="Time">Time:</label> <select name="Time" id="Time"> <option value="9:00">9:00 am</option> <option value="9:30">9:30 am</option> <option value="10:00">10:00 am</option> <option value="10:30">10:30 am</option> <option value="11:00">11:00 am</option> <option value="11:30">11:30 am</option> <option value="12:00">12:00 pm</option> <option value="12:30">12:30 pm</option> <option value="13:00">1:00 pm</option> <option value="13:30">1:30 pm</option> <option value="14:00">2:00 pm</option> <option value="14:30">2:30 pm</option> <option value="15:00">3:00 pm</option> <option value="15:30">3:30 pm</option> <option value="16:00">4:00 pm</option> <option value="16:30">4:30 pm</option> <option value="17:00">5:00 pm</option> <option value="17:30">5:30 pm</option> <option value="18:00">6:00 pm</option> <option value="18:30">6:30 pm</option> <option value="19:00">7:00 pm</option> <option value="19:30">7:30 pm</option> <option value="20:00">8:00 pm</option> <option value="20:30">8:30 pm</option> <option value="21:00">9:00 pm</option> </select> </span></p> <p> <span class="text"> <input type="hidden" class="text" name="date"value="search"> <input type="submit" value="Search" /> </span></p> <p> </p> </form> </body> </html>
-
I have a form with a field for users to type in the current date. My question is, is there any way for me to have the current date to automatically populate in this field? Here's the code I am using: <tr> <td><b>Date Assigned (YYYY-MM-DD):</b> <br /><input type="text" name="date_assign" size="25" /><br /> </tr> If I could get todays date to automatically pop in this that would be great! Thanks
-
Hi, I'm confused about this code: <?php //phpinfo(); $twentyEightDaysOffset = 28; echo "Since time immemorial: " . time() . "<br><br>"; echo "Offset 28 days ago: " . (time() - ($twentyEightDaysOffset * 24 * 60 * 60)) . " and now in days: " . (date('Y-m-d', time() - ($twentyEightDaysOffset * 24 * 60 * 60))) . "<br><br>"; echo "A slightly more clever way of doing this: " . (date('Y-m-d', strtotime('-28 day'))) . "<br><br>"; ?> When I run this code, this is what I get: Since time immemorial: 1352153998 Offset 28 days ago: 1349734798 and now in days: 2012-10-09 A slightly more clever way of doing this: 2012-10-08 Now, here is my question. Why is it that when I do (time() - (28 * 24 * 60 * 60)), I get a different date than when I run strtotime('-28 day')? And why is it that when I set the strtotime('-9 day) and $twentyEightDaysOffset to 9, that's when the drift in dates begins? Also, is there a way to post PHP code with indentations so that it looks better?
-
I have an html form that takes a date and send it to an php script: <form action='tupdatecompletiondate.php' method='post'><input type='hidden' name='idtosubmit' value=$id><tr> <td><label>Date:</label></td> <td><input type= 'date' name= 'date' value='Select Date' id='popupDatepicker'></td> </tr><input type='submit' value='Click to Update'></form> I've got it going to this script: $id = $_POST['idtosubmit']; $date = $_POST['date']; $datetoset = date('Y-m-d', strtotime($date)); $sql = "UPDATE needs SET completiondate=$datetoset WHERE ID=$id"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } mysql_close(); Confused as to why it's not working. It takes the date, sends it to the php script, makes it into a format that is accepted by the DATE column, and then puts it in that column....well at least its supposed to.
-
What I need to do is query a table based on a date. Then, if the query returns a "W" or an "H", I need to add one day to the date, then run the query again, until it doesn't return either a "W" or an "H". My code works fine when the initial query doesn't return a W or H, but when it does, it times out, seemingly in and endless loop. So clearly, something I'm doing with the loop isn't correct. Can someone help with my logic? Thanks very much from this first time visitor to PHP Freaks! Here's the code: <? $testdate = date("Y-m-d", strtotime("2012/09/30")); include("includes/databasedateretrieval.inc"); $dateverify = mysql_result($date_result,0,"1_day"); $dfresult = $dateverify; // Check for dating errors while ($dfresult == "W" || $dfresult == "H"){ //convert the date to time $todaydate = strtotime($testdate); //add 1 day to the date $todaydate = $todaydate + (24*60*60); //convert the date back to a format compatible with the table data $testdate = date("Y-m-d", $todaydate); //here I'm querying the table again to see if the new date returns a W or H $dateverify = mysql_result($date_result,0,"1_day"); $dfresult = $dateverify; } ?> <? echo $testdate; ?>
-
Hi, I need help with looping through the dates of working days (Monday to Friday) for the following week. I need to send an email once a week (probably on a Thursday or Friday) informing people of their rooms for the following week. I need to loop through each day, starting with Monday and finishing on Friday. I wrote this: for($i=0;$i<5;$i++) { echo date('Y-m-j', strtotime('Monday+'.$i)).'<br />'; } I thought this would work, but it returns the correct date for next Monday (2013-03-25) and then the other 4 days are all showing as 2013-03-24. Any ideas how I can get this to work? Thank you for taking the time to help. Many Thanks, John