1. Go to this page and download the library: Download leafs/date library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
leafs / date example snippets
// Get current date in a specific format
echo tick()->format('MMMM Do, YYYY'); // March 31st, 2025
// Chain methods for complex operations
$nextFriday = tick()->add(1, 'week')->startOf('week')->add(4, 'day');
echo $nextFriday->format('dddd, MMMM D'); // Friday, April 11
// Current date and time
echo tick()->now(); // 2025-03-31T12:29:29+00:00
// Parse a specific date
$birthday = tick('1990-05-15');
echo $birthday->format('MMMM D, YYYY'); // May 15, 1990
// Manipulate dates
$futureDate = tick()->add(3, 'months')->subtract(2, 'days');
echo $futureDate->format('YYYY-MM-DD'); // 2025-06-29
// Current date and time
tick();
tick()->now();
// From string
tick('2025-03-31');
tick('2025/03/31');
tick('March 31, 2025');
// From DateTime
tick(new DateTime('2025-03-31'));
// From tick object
$tomorrow = tick('2025-03-31')->add(1, 'day');
tick($tomorrow);
// Get tomorrow's date
$tomorrow = tick()->add(1, 'day');
// Get the first day of next month
$nextMonth = tick()->add(1, 'month')->startOf('month');
// Get last day of current month
$lastDay = tick()->endOf('month');
// Check if a date is on a weekend
$isWeekend = tick('2025-04-05')->day() === 0 || tick('2025-04-05')->day() === 6;
// Calculate age
$birthdate = tick('1990-05-15');
$age = tick()->diff($birthdate, 'years');
// Calculate days until an event
$christmas = tick('2025-12-25');
$daysUntilChristmas = $christmas->diff(tick(), 'days');
// Calculate business days between dates
$workDays = tick('2025-04-01')->diffBusinessDays(tick('2025-04-30'));
// Create a date in a specific timezone
$tokyoTime = tick('2025-03-31', 'Asia/Tokyo');
// Convert between timezones
$newYorkTime = $tokyoTime->setTimezone('America/New_York');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.