Skip to content

gramos74/pt_date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pt_date
--------------------------------------------------------------------------------

This library works with PHP 5.x.
In order to run the tests, phpunit is required.

This library provides a way to work with dates in php.

Source in [https://github.com/gramos74/pt_date]



Examples
--------------------------------------------------------------------------------

Create a pt_date object with the current date:
    
    date = new pt_date();
      or
    date = new pt_date(time());

Add 2 months to the current date

    date = new pt_date();
    date->add_months(2);
    
Move to the begin of the month and add 5 hours:
   
    date = new pt_date();
    date->move_to_begin_of_month()->add_hours(5);

Get days between 2 dates:

    date1 = new pt_date("2009-10-15 00:00:00");
    date2 = new pt_date("2009-10-22 00:00:00");
    
    echo $date1->days_between($date2); --> 7
        or
    echo $date1->days_between("2009-10-22 00:00:00"); --> 7



License
--------------------------------------------------------------------------------

Licensed under the Apache License, Version 2.0 (the "License")  (see LICENSE)
Gabriel Ramos <gabi@gabiramos.com>

About

Class date for php

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages