PHP Code Snippets

PHP Snippets in Date And Time
David Carr

This function returns an array of dates between 2 dates.

Read more

David Carr

Pass this function 2 dates it will return the total number of weekdays between the 2 days, pass true as a third param to return the number of weekend days

Read more

David Carr

using DateTime to get the difference between 2 dates the first and second params are dates then last param is optional

Read more

David Carr

Using TIMESTAMPDIFF get the total hours between 2 dates.

Read more

David Carr

The snippet below will return the number of week days between 2 dates also exclude any dates in an array such as bank holidays

Read more

David Carr

by using strtotime you can format a date how way you like its a case of modifying the flags in the date().

Read more

David Carr

Snippet to re-order date vars to put them in the correct format for mysql entry.

Read more

David Carr

This function takes the date and time and returns how much time has passed, just like twitter does.

for example 10 seconds ago

Read more

Copyright © 2011 - 2017 created by David Carr Web Developer. All code MIT license. All rights reserved. Built using Simple MVC Framework