Jump to content

Search the Community

Showing results for tags 'datetime'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 12 results

  1. Hi look for some help with querying based on todays date. I'm trying to count all the entries in the database based on username, status, date. The date bit is where I' stuck (see screen shot of database) Based on data in database I should get a count of 3 but get nothing?? The result I get is 0 and should be 3 based on date Any help would be a great help Cheers Chris //date bit $d=strtotime("today"); $wholedate2 = date("Y-m-d", $d); //query $query_rsUser = "SELECT COUNT(*) FROM quotes WHERE quotes.quote_user = 'username' AND quotes.quote_complete = '$date2' AND quotes.quote_status = 'Complete'";
  2. Hi everyone, i am marking a number of php questionnaire forms on my webpage and they connect up to a Mysql database, so far so good. However, the part i am having trouble with is... i need certain questionnaires to only be released for fixed periods of time (for example 1/2 weeks). Would anyone be able to help me out and give me some idea of how i would go about this? Thanks
  3. Hello, I need the php way to take this kind of mysql datetime field: 1390146482 and make it into this kind: 19/01/2014 I already know how to get and insert, I just need some help with translation. This datetime thing is confusing!
  4. i have the below given time interval options in a dropdown (those are strings) <select name="CSSAtapsClient[client_time_window][0]" id="client_time_window_0"> <option value="5702">7am - 10am</option> <option value="5703">10am - 1pm</option> <option value="5704">12pm - 3pm</option> <option value="5705">3pm - 6pm</option> <option value="5706">6pm - 9pm</option> <option value="5707">7pm - 10pm</option> <option value="5708">9pm - 12am</option> <option value="5709">12am - 7am</option> </select> I need to convert these intervals for a specific GMT time zone. for example lets say its in GMT +8 and i need to convert it to GMT +10 and it can be done by adding 2 hours. so if the given time interval is, 7am - 10am (GMT + it should come as 9am - 12pm (GMT +10) What is the best way to convert this kind of a time interval ? The issue i am seeing here is its a string (time interval). Appreciate an early reply. EDIT 1 I am converting to only Australian states so there is no chance of getting a day as difference when converting. pls check this link http://www.timebie.com/tz/australiatimezone.php
  5. Can any one tell me what's wrong with this code? it's just keep giving me this message "Pick up Date atleast 24hrs after the current Date"; $pDate = $_GET['txtPDate']; $pTime = $_GET['txtPTime']; $dateArray = explode('-',$pDate); $timeArray = explode('.',$pTime); $hours = (int)$timeArray[0]; $minutes = (int)$timeArray[1]; $day = (int)$dateArray[0]; $month = (int)$dateArray[1]; $year = (int)$dateArray[2]; $userPTimes = mktime(date($hours),date($minutes),0,date($month), date($day), date($year)); $userCurrentTime = mktime(0, 0, 0, date($day), date($month), date($year)); $userupperlimit = mktime(date(7), date(30), date(0), date($day), date($month), date($year)); $userlowerlimit = mktime(date(20), date(30), date(0), date($day), date($month), date($year)); $dayafter = mktime(0, 0, 0, date($day +1), date($month), date($year)); // I wanted $dayafter to 24 hours after the $pdate if($userCurrentTime < $dayafter) { echo "Pick up Date atleast 24hrs after the current Date"; } else if(!($userPTimes >= $userupperlimit) || !($userPTimes <= $userlowerlimit )) { echo "Pick up Time should be between 7.30 - 20.30"; }
  6. For example lets say I want to check whether the user input is in between 7.30 and 20.30 how can i implement in php? Sorry if this seems to be a stupid question, I'm a beginner
  7. Hi all, So i am passing a data from a form, in the format yyyy-mm-dd. I want to convert that to dd/mm/yyyy but for some reason i cant get it to work. Can anybody tell me what im doing wrong? $date = $_GET['date']; $date_uk = $date->format('d/m/Y'); Error is: Fatal error: Call to a member function format() on a non-object Thanks in advance for any help, Matt
  8. Hi all, im using the following sql query to select data from two tables where the most recent value for 'par' is > 6. SELECT patients.*, addobs.*, DATE_FORMAT(addobs.datetime, '%d/%m/%Y %H:%i:%s') as dti1 FROM addobs INNER JOIN patients ON addobs.MRN = patients.MRN WHERE addobs.datetime = (SELECT MAX(OLAST.datetime) FROM addobs AS OLAST WHERE OLAST.MRN = patients.MRN) AND addobs.par > 6 AND NOT addobs.hidden = 'yes' AND COALESCE(patients.ward,'') != 'dc' order by addobs.par ASC I would like to extend this query to also return as 'dti2', the datetime value that par > 6 LAST BECAME true. To clarify, if i have 5 values as follows: datetime par 06-18-2013 05:00:00 7 06-18-2013 04:00:00 8 06-18-2013 03:00:00 7 06-18-2013 02:00:00 2 06-18-2013 01:00:00 10 Then the datetime to be returned by my query as dti2 would be 06-18-2013 03:00:00, as this is the time that par>6 LAST BECAME true (and it has STAYED true since this time) This is to be distinguished from 06-18-2013 01:00:00 (which is when PAR>6 FIRST became true) and also to be distinguished from 06-18-2013 05:00:0 (which is when PAR>6 was LAST true) To give some context for further clarity: PAR is a measure of how unwell a patient is (larger numbers = more unwell). So i am trying to create a list of unwell patients. I want to return patients who have a PAR score of >6 (which is what my query currently achieves) and the amount of time they have had CONSECUTIVE par scores >6. From my limited knowledge of sql i would have thought that this could be done somehow with coalesce but im not sure exactly how. i have tried a few different things with no luck. I hope that all makes sense, i get a little confused even explaining it! Thanks for any help anyone can give in advance, Best, Matt
  9. How to add time in mysql database from a textbox. <form name="addTime" action="<?php echo $SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="time" /> <input type="submit" name="enterTime" /> </form>
  10. Hi all, Im new to php and im trying to do something a bit fiddly. I was wondering if anyone knows how... I have a table 'obs' with columns '_sfm_form_submision_time_' (date and time of submission of dataset in format YYYY-MM-DD HH:MM:SS), 'mrn', 'sbp' and a few other variables. I want to echo the sbp and TIME (in the format HH:MM from _sfm_form_submision_time_), as long as the DATE of submission was today (ie date in _sfm_form_submision_time_ is current date) for a given value for mrn (passed from previous page). Ie, if 3 data sets were entered today for mrn 001 then i want to display the times these were entered, and the sbp entered. I have this so far but it keeps telling me no results for mrns that have datasets enetered today, so somewhere the code must be wrong but i can't figure out where! Any help to find the problem would be amazing, thanks! <?php //STEP 1 Connect To Database $connect = mysql_connect("localhost","jasperss_par1","password"); if (!$connect) { die("MySQL could not connect!"); } $DB = mysql_select_db('jasperss_par1pats'); if(!$DB) { die("MySQL could not select Database!"); } //STEP 2 Check Valid Information if(isset($_GET['mrn'])) { //STEP 3 Declair Variables $Search = $_GET['mrn']; $Find_Query1 = mysql_query("SELECT DATE_FORMAT(_sfm_form_submision_time_,'%H:%i') TIMEONLY, SBP FROM obs WHERE mrn='$Search' AND _sfm_form_submision_time_=CURRENT_DATE()"); if(!$Find_Query1) { die(mysql_error()); } // STEP 4 Get results while($row = mysql_fetch_assoc($Find_Query1)) { echo '<br/> TIME: '.$row['_sfm_form_submision_time_']; echo '<br/> SBP: '.$row['SBP']; echo '<br/>'; } $numCount = mysql_num_rows($Find_Query1); // STEP 5 error message if no results if ($numCount < 1) { print("no sbp found for that mrn today"); } } ?> Thanks again! M
  11. Hello, I have a question about datetime. In my website, i have member from canada, usa, france, sweden, belgium..... and a lot of other country Until now, i setup my server for the time GMT, so every date was save at the time of GTM, so every message, profile modification date were always save with that date. In my code: i did: $mDate = new DateTime($profile["DerniereVisite"]); if(!isset($_SESSION["uTimeZome"])) $_SESSION["uTimeZome"]="UTC"; if($_SESSION["uTimeZome"]!="UTC")[b]{ [/b] $tz = new DateTimeZone($_SESSION["uTimeZome"]); $mDate->setTimezone($tz);[b]}[/b] $DerniereVisite = formatTExtDate($mDate->format('Y-m-d G:i:s')); so the $_SESSION["uTimeZome"] keep the good time zone for php for this members, depending on with country he or she is So, with all the test i did, my way works. But now, i change my server for a better server with another compagny. Today, i realize that my server has the localsetting, i mean the server has the date and time for Canada(qu├ębec). So i realize that there are some date, that are not converted correctly for some user in other country. So i ask to the administrator for the server to change it to GMT! But his answer was, it's not good to change datetime zone for a server...... that my way to do this is probably wrong and i should check my code...... after some discussion, they finish to change de timezone as i asked. But my question, do i use a good way or a bad way? thanks a lot! Pascal
  12. First off...Hi everyone, I'm hoping you all can help. I'm working on a script that stores datetimes of users logging in and out of a system. I've found out how to get the time the user was logged in using the following code. $q = "SELECT * FROM VISITOR WHERE MONTH(timeIn)=MONTH(NOW()) ORDER BY id"; $monthsVisitors = mysql_query($q); while($row = mysql_fetch_array($monthsVisitors)) { $timeIn = $row['timeIn']; $timeOut = $row['timeOut']; $timeDiff = dateDiff($timeOut, $timeIn); } Assuming I store hundreds of entries in the "Visitor" table, with each row containing a "timeIn" and "timeOut". What would be the best way to get an average of "$timeDiff"?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.