This PHP Date Formatter package provides convenient methods for formatting dates, calculating date differences, and handling timestamps in PHP applications.
You can install this package via Composer:
composer require developeraio/date-formatter
Instantiate the Date Formatter class and utilize its methods as needed.
The constructor initializes the Date Formatter with default format and timezone settings.
public function __construct($defaultFormat = "Y-m-d H:i:s", $defaultTimezone = "UTC")
Formats a Unix timestamp according to the specified format and timezone.
public function formatDateWithTimeStamp($timestamp, $format = null, $timezone = null)
Formats a date string according to the specified format and timezone.
public function formatDate($dateString, $format = null, $timezone = null)
Calculates the number of days between two timestamps.
public function getDaysDifference($startTimestamp, $endTimestamp)
Calculates the number of hours between two timestamps.
public function getHoursDifference($startTimestamp, $endTimestamp)
Calculates the number of hours and minutes between two timestamps and returns an array.
public function getHoursAndMinutesDifferenceArray($startTimestamp, $endTimestamp)
Calculates the number of hours and minutes between two timestamps and returns a formatted string.
public function getHoursAndMinutesDifferenceString($startTimestamp, $endTimestamp)
Calculates the number of years and remaining days between two dates and returns an array.
public function getYearsAndDaysDifferenceArray($startDate, $endDate)
Calculates the number of years and remaining days between two dates and returns a formatted string.
public function getYearsAndDaysDifferenceString($startDate, $endDate)
This PHP Date Formatter package offers convenient methods for handling date and time-related operations in PHP applications.
This documentation provides clear explanations of each method available in the PHP Date Formatter package, allowing users to understand its usage and functionality easily when reading the README.md file on GitHub. Adjust the package name and namespace as necessary based on your specific implementation.