Download the PHP package nabeghe/dati without Composer
On this page you can find all versions of the php package nabeghe/dati. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package dati
Short Description A simple DateTime helper for common stuff.
License MIT
Homepage https://github.com/nabeghe/dati-php
Informations about the package dati
Dati (Date Time Helper for PHP)
A simple DateTime helper for common stuff.
Converting dates between the Gregorian and Jalali (Shamsi/Persian) calendars and vice versa, Checking the validity of Gregorian and Jalali dates, spam detection based on datetime sequences, detecting datetime formats, calculating the difference between two datetimes in a preferred unit or the largest possible unit, remaining time between two datetimes based on validity, checking for leap years in both Gregorian and Jalali calendars, adding a value to a datetime, converting timezones to a desired or local one, month names, month lengths, current time, and so on!
Notice: To convert Gregorian dates to Jalali and vice versa, the intl
extension must be enabled in PHP.
🫡 Usage
🚀 Installation
You can install the package via composer:
Dati Class
Example 1:
Example 2 - Check Spam:
Sometimes it is necessary to check the datetime of an action to determine if it is spam. For example, reviewing the last ten datetimes of messages or tickets that have been sent.
datetimes
: Sequence of datetimes.offset
: If the difference between two consecutive datetimes is equal to or less than this amount, a warning indicating potential spam has occurred.limit
: Receiving how many warning indicates spam?strict
: If it's not strict, if no warning is received between two consecutive datetimes, one of the previous warnings will be reduced.
Months Class
Access to the names and lengths of the months in the Gregorian, Jalali, and lunar calendars.
Now Class
Access to the current datetime.
Example 1:
Example 2 - Initialization with previous values
If it is necessary to use a previously obtained datetime.
📖 License
Copyright (c) Hadi Akbarzadeh
Licensed under the MIT license, see LICENSE.md for details.
All versions of dati with dependencies
ext-intl Version *