To format a date in the given format, you can use the date()
and strtotime()
functions in PHP.
Here's an example code snippet:
main.php193 chars6 lines
Explanation:
strtotime()
function to convert this date string to a Unix timestamp.date()
function. The format string F j, Y g:i:s a
represents the required format of month, day, year, hour, minute, second, and am/pm.This will output the formatted date as December 31, 2022 6:30:00 pm
.
gistlibby LogSnag