Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stdevteam/yii-date
Date and time related processing for Yii framework
https://github.com/stdevteam/yii-date
Last synced: 4 months ago
JSON representation
Date and time related processing for Yii framework
- Host: GitHub
- URL: https://github.com/stdevteam/yii-date
- Owner: stdevteam
- Created: 2013-01-24T11:35:30.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2022-11-30T12:35:05.000Z (about 2 years ago)
- Last Synced: 2023-04-05T10:00:46.181Z (almost 2 years ago)
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 6
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
yii-date
========Date and time related processing for Yii framework
Sample usage within a controller
========Use any of this methods as shown in the example below
```php
Date->now();
//Returns current datetime formatted for MySQL without the timezone offset applied to it
echo Yii::app()->Date->now(false);
//Formats almost any date string or timestamp to a MySQL compatible datetime string with the timezone offset applied to it
echo Yii::app()->Date->toMYSQL($date);
//Formats almost any date string or timestamp to a MySQL compatible datetime string without the timezone offset applied to it
echo Yii::app()->Date->toMYSQL($date, false);
//Returns the timestamp of current date in seconds with the timezone offset applied to it
echo Yii::app()->Date->timestamp();
//Returns the timestamp of current date in seconds without the timezone offset applied to it
echo Yii::app()->Date->timestamp(false);
//Returns a datetime string to add to database as default for datetime columns
echo Yii::app()->Date->nullDateTime();
////Returns a date string to add to database as default for date columns
echo Yii::app()->Date->nullDate();
//Given start and end dates in almost any format claculates the number of days within the interval
echo Yii::app()->Date->daysCount('10-02-2022', '24-01-2022');
//Given a year or a date string returns the number of days that the year contains (365 or 366)
echo Yii::app()->Date->daysInYear($yearOrDate);
//stop the execution
Yii::app()->end();
}
}
```