PHP - Moved: How To Display Time With Meridian
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=314226.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=321950.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=316461.0 Hey guys, How would I go about subtracting Today from a previous day to find the difference? For example, I want to subtract TODAY from a previous date in my database, to determine if the difference is greater than 1 day. Any ideas? I tried doing the subraction in TIMESTAMPS, but when I convert the date back to Y-m-d H:i:s, I got some weird year and time. At the moment I have: $month_end_date[$surgeryinvoicescount]=$i[0]; = 2011-04-13 I would like $month_end_date[$surgeryinvoicescount]=$i[0]; = 13/04/2011 I have tried the following but didn't work?!: $month_end_date = date('d/m/Y',strtotime($month_end_date)); $month_end_date[$surgeryinvoicescount]=$i[0]; I am trying to display "open" / "closed" depending on the time of day. I tried to write my own script but it doesn't seem to be working. Does anyone know of some boxed script I can use? Here is what I have... function open(){ $AMPM = date('A', time()); if ($AMPM == "PM"){ connect(); $day = date('l'); $sqlcurrent = "select * from hours where day = '$day' and closed ='1'"; $currently = mysql_query($sqlcurrent) or die(mysql_error()); $checkDay = mysql_num_rows($currently); if ($checkDay == "1"){ while($getID = mysql_fetch_assoc($currently)){ $convertopen = strtotime($getID['open']); $convertclose = strtotime($getID['close']); $displayTimeH = date('H', time()); $displayTimeM = date('i', time()); $displayTimeAMPM = date('A', time()); $opentime = explode(":", $getID['open']); $openhour=$opentime[0]; $openminute=$opentime[1]; $closetime = explode(":", $getID['close']); $closehour=$closetime[0]; $closeminute=$closetime[1]; //echo "$closehour$closeminute<br />"; //echo "$displayTimeH$displayTimeM<br />"; if (($openhour <= $displayTimeH && $openminute <= $displayTimeM) && ($closehour >= $displayTimeH && $closeminute >= $displayTimeM)){ echo "We're Open ... Come On In!"; }else{ echo "Hours of Service"; } } }else{ echo "Hours of Service"; free($currently); } }else{ echo "Hours of Service"; } } // close function I know it's brutal but it's all I could come up with... Hello Everyone, I wanted to know how to Display records from a Table one by one at difference time intervals. Kindly suggest Hey all. I have a query that selects data from a datbase based on a criteria. Easy enough. But now I am growing and the amount displaying is too much. How can you, via php, have a queries result be displayed only so many at a time and auto create links that show the rest? Like if query returns 82 results, I want it to display 25 immediately and create 3 links at the bottom. The next link would show 26-50. The next 51-75. And the final 76-82. etc Example: Code: [Select] $result = mysql_query("SELECT * FROM pay"); $num_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { echo $row['first_name']; echo $row['last_name']; echo $row['item_name']; echo $row['option_selection1']; echo $row['payment_date']; echo $row['stat']; } This is simple. But what happens when the results are 125? I want to limit it to displaying 25 at a time. Is the only way to manually create seperate pages and have each one show 1-25, then 26-50, etc? Or is there a way to have the script do it, itself? Any tutorials out there on this specifically? Hopefully I am making sense. Thanks! I'm interested to know how other people keep track of time and also how they display time correctly back to the users. I'm using a third party API that I can tie into that actually gives me the userID of a user, their full name and the timezone for that user. After checking a few users data, this is an example data of what I'm working with. userID: 234213412 first_name: foo last_name: bar timezone: -6 Basically when a user visits my web app, I create a new account for them and store the above data. Currently, I'm just fetching the result from time() and converting it into MySQL DateTime format and storing that into my database. Code: [Select] //get the current time as an integer $php_timestamp = time(); //formats the time according to MySQL DateTime type $this->mysql_formatted_time = date('Y-m-d H:i:s', $php_timestamp); I would think the current way that I'm doing this is not very good because there is a possibility that I could introduce load balancing servers into the mix and they might not be located in the same region. Also, I would have no idea how to factor the time and modify it according to the timezone value.(in my above example, -6) Can anyone help me decide what method I should use to keep all of my servers timestamps in sync and how to display the time to the end user so that it looks correct to them? This topic has been moved to PHP Math Help. http://www.phpfreaks.com/forums/index.php?topic=328102.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=327525.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=315056.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310181.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=316616.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=355963.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=306905.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=348274.0 This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=322054.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=326408.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=332434.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=342944.0 |