Convert Shorthand Date to Long Form


/ Published in: PHP
Save to your folder(s)

Frequently I like to make data more user friendly, so while I make it easy for them to add a date as a shorthand format (mm/dd/yyyy) I like to return it as something easier to digest (Day of Month in Year, etc). This is the simplest way to do that I've found


Copy this code and paste it in your HTML
  1. list($day, $month, $year) = split('/', $date);
  2. echo date('l, F jS ', mktime(0, 0, 0, $month, $day, $year));

Report this snippet


Comments


You need to login to view comments.