Byt Wiki

Date Functions Documentation

formatDate

Format a date to a readable string.

Usage:

$formattedDate = formatDate('2024-07-30 13:49:26', 'F j, Y, g:i a');
echo $formattedDate; // Output: July 30, 2024, 1:49 pm

timeSince

Calculate the time since a given date.

Usage:

$timeAgo = timeSince('2024-07-30 13:49:26');
echo $timeAgo; // Output: e.g., '2 days ago', '3 hours ago'

getCurrentDateTime

Get the current date and time.

Usage:

$currentDateTime = getCurrentDateTime('Y-m-d H:i:s');
echo $currentDateTime; // Output: Current date and time in the specified format