Jump to content

Search the Community

Showing results for tags 'strtotime date'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have a script which calculates how many hours a truck driver has worked/rested in increments of 15 minutes. For a given number of hours I loop around adding 15 minutes to a cursor for each 15 minutes of work/rest. This all works fine until 7 Oct 2012 when adding 15 minutes to 01:45:00 gives a result of 03:00:00 instead of 02:00:00 Here's my code: <?php $diff = 4; // Number of hours difference in units of 15 minutes $cursor = "2012-10-07 00:00:00"; // Start time, midnight on 07 October 2012 for($z=0;$z<$diff/.25;$z++) { print "Cursor = ".$cursor."<br>"; $cursor = date('Y-m-d H:i:s', strtotime( "$cursor + 15 minutes" )); } ?> This is the result: Cursor = 2012-10-07 00:00:00 Cursor = 2012-10-07 00:15:00 Cursor = 2012-10-07 00:30:00 Cursor = 2012-10-07 00:45:00 Cursor = 2012-10-07 01:00:00 Cursor = 2012-10-07 01:15:00 Cursor = 2012-10-07 01:30:00 Cursor = 2012-10-07 01:45:00 /* Jumps to 03:00:00 instead of 02:00:00 */ Cursor = 2012-10-07 03:00:00 Cursor = 2012-10-07 03:15:00 Cursor = 2012-10-07 03:30:00 Cursor = 2012-10-07 03:45:00 Cursor = 2012-10-07 04:00:00 Cursor = 2012-10-07 04:15:00 Cursor = 2012-10-07 04:30:00 Cursor = 2012-10-07 04:45:00 Can anyone help??
×
×
  • 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.