3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function format_date_input($value) { if (strpos($value, '/') != false) { // Delimiter is '/' - jQuery datepicker in use list($day, $month, $year) = explode('/', $value); } else if (strpos($value, '-') != false) { // Delimiter is '-' - HTML5 datepicker in use list($year, $month, $day) = explode('-', $value); } else return ''; $usdate = $month.'/'.$day.'/'.$year; $timestamp = strtotime($usdate); if ($timestamp == false) return ''; else return date(DATE_STORAGE_FORMAT, $timestamp); } echo format_date_input('2014-01-10'); ?>
Output for 4.3.0 - 7.1.0
Notice: Use of undefined constant DATE_STORAGE_FORMAT - assumed 'DATE_STORAGE_FORMAT' in /in/XqPnH on line 12 FriAMCETE_thCET+0100RAM0E_January+0100RJanAMCET