Jump to content

Search the Community

Showing results for tags 'date'.

More search options

  • 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 (Dreamweaver, Zend, 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. On another forum I ran across someone with a problem I have never had to deal with and am interested in the solution for it. He has dates in varchar formatted as 12/25/2015 and wants to update so the date is formatted as a proper date (YYYY-MM-DD) with a date column type. Off the top of my head I was thinking, Create a new date type column Do an update on the dates to replace the slashes with dashes. UPDATE table SET baddate = REPLACE(baddate, '/', '-'); Then make a little script to query the bad dates in reverse twice and re-insert the data with a foreach to the correct date column. SELECT reverse(baddate) AS rev, (SELECT REVERSE(rev) FROM mytable) FROM mytable foreach ($result AS $row){ //Insert data to real date column } I am wondering what a 100% sql solution would be or any other ideas to deal with it.
  2. Hi, I'm stuck on below, I have a table called History that records date and time as timestamp, example attached below I'm trying to count the number of entries with todays date, below is the php for todays date and the query, Any one help point me in the write direction. $d=strtotime("today"); $wholedate = date("Y-m-d", $d); $date_array = explode('-', $wholedate); $date = mktime(0,0,0,(int)$date_array[1],(int)$date_array[2],(int)$date_array[0]); $query_rsWorkedToday = "SELECT COUNT(*) FROM history WHERE history_date = β€˜$date’”;
  3. I've got an HTML 5 date input box working on my site. Anyone know how to make the whole thing selectable like a drop down (select) box? Currently you can only select it by clicking on the arrow at the far right of it. I don't mind about losing the cross or up and down arrows. I just want the field to be fully selectable like a drop down box. Any ideas please? Thanks.
  4. Hi All, I'm really hoping someone can help me as i'm sure there's quite a simple solution to this. I'm building a form in Wordpress using a form builder plugin. The form has several date fields that clients need to fill in to tell us when they will be sending us print files and then a 2nd set of fields for when they need to be sent back. I've found some code on the plugin devs website that shows me how to set the 2nd date to be XX number of days after the 1st date but it only works if you have 2 date fields in your form. I currently have about 40 so i need to know how to extend this code to include more date fields. Here is the code the plugin dev supplied: add_action('frm_date_field_js', 'start_and_end_dates', 10, 2); function start_and_end_dates($field_id, $options){ $key_one = 'pickup';// Change pickup to the KEY of the first date field $key_two = 'dropoff';// Change dropoff to the KEY of the second date field $days_between = 0;// Change 0 to the number of days that should be between the start and end dates if ( $field_id == 'field_'. $key_one ) { echo ',beforeShowDay: function(dateOne){var secondDate=$("#field_' . $key_two . '").datepicker("getDate");if(secondDate==null){return[true];}var modDate=new Date(secondDate);modDate.setDate(modDate.getDate()-' . $days_between . '+1);return [(dateOne < modDate)];}'; } else if ( $field_id == 'field_' . $key_two ) { echo ',beforeShowDay: function(dateTwo){var firstDate=$("#field_' . $key_one . '").datepicker("getDate");if(firstDate==null){return[true];}var modDate=new Date(firstDate);modDate.setDate(modDate.getDate() + ' . $days_between . '-1);return [(dateTwo > modDate)];}'; } else { echo ',beforeShowDay: null'; } } So in effect all i need to do is find out how to extend this to add more date fields. Any help would be amazing as i'm very new at this and know very little about coding. Thanks Chris
  5. Say I have a simple date like this. $date = 2017-08-10 00:06:10; I would like to have an if statement that tells me whether or not the date is empty. These are my methods but I'm not sure if it's the proper way of doing it. . if(empty($date)) { // do nothing } else { // do something } if($date == 0000-00-00 00:00:00) { // do nothing } else { // do something }
  6. Hello, Basically ive got a html drop down list, with various options based on urgency. One of the options is "Can wait" and if the user selects this option I want them to be displayed with a date picker so that they can pick a date. Ive got a HTML5 date picker in the form but its displayed all the time, whereas im looking for it to be displayed only if the user picks "Can wait". Is there a method I could use to get that to work? I need to get this working and I have done research, but to no avail. Any help would be greatly appreciated. Thanks.
  7. I am trying to format a normal date into a timestamp. To convert a timestamp into the normal date was no problem, but now I have an array with 4 different dates! 2 normal dates : 1991-12-09, 12.03.1984 and also 2 timestamps in one array. If I had the same format I could strpos it and make an if and test with "." that worked last time, but now I have those 4 different formats. Anyone an idea?
  8. Hi, I could do with a bit of help with this, not sure where I'm going wrong. The following code is used to change the colour of a row based on date. I want to compare to todays date with the following results If < today (turns red) if == today (turns orange) if > today (turns green) I have included a screen shot of result I'm getting with below if statement <?php $requireddate = date('l jS F',$row_rsActiveQuotes['quote_requireddate']); //this is anthing before today's date if ($today < $requireddate) { echo '<tr class="tableBody2">'; } //this is anthing with today's date elseif ($today == $requireddate) { echo '<tr class="tableBody3">'; } //this is anthing with today's date elseif ($today > $requireddate) { echo '<tr class="tableBody1">'; } else //this is anthing from tommorow { echo '<tr class="tableBody4">'; } ?>
  9. Please Can someone help me on this Am creating a timetable system and i want to check only the time difference Am collect a time only from the html form thus $startTime = 13:30:00 $endTime = 14:00:00 How can i find the deference between this time from the html in php. Thanks
  10. Hi, I have two date and time stamps stored in my database, I'm using the below script to calculate the difference but whenever I'm getting an extra 1 hour added ?? Any ideas, Cheers Chris <?php $start = $row_rsComplete['quote_added']; $finish = $row_rsComplete['quote_complete']; $difference = ($finish - $start); $day = round(($difference % 604800) / 86400); $hours = round((($difference % 604800) % 86400) / 3600); $minutes = round(((($difference % 604800) % 86400) % 3600) / 60); echo $day." days"."<br/>"; echo $hours." hours"."<br/>"; echo $minutes." minutes"."<br/>"; ?>
  11. Hi Im creating a countdown timer to show a result but I only want to show the result for x time then I want it to disappear, but seems like Somewhere I'm going wrong with my if functions any help... <html> <?php define('TIMEZONE', 'Africa/Harare'); date_default_timezone_set(TIMEZONE); $targetDate = new DateTime('2015-11-24 11:57:00'); $runningDate = new DateTime('2015-11-24 12:08:00'); $time = new DateTime(); $remaining = $targetDate->diff(new DateTime()); // not done if( $time < $targetDate ) { echo $remaining->format('%a D - %H:%I:%S'); //--> 86 D - 19:44:24 } // done elseif($targetDate < $runningDate ) { print "The time has been reached show this messagt till runningdate is reached"; } elseif($time > $runningDate ) { print ""; }else{ print ""; } ?> </html>
  12. Here is my countdown counter code. It works. But I would like to show multiple of these countdown counters with different dates, on a single page. I tried duplicating them and giving them different "due" id name but I the result I get is like this "NaNd NaNh NaNm NaNs". What's the proper way to duplicate the code below and give them different dates? <div id="due"></div> <script> // Set the date we're counting down to var countDownDate = new Date("2017-05-05 19:01:58c").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = countDownDate - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Display the result in the element with id="due" document.getElementById("due").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is finished, write some text if (distance < 0) { clearInterval(x); document.getElementById("due").innerHTML = "OVERDUE"; } }, 1000); </script>
  • 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.