0) { $cval = $_POST['inp_convertval']; $ret = 0; if(is_numeric($cval) && $cval >= 0) { $timestamp = $cval; } else if(($ret = strtotime($cval)) != -1) { $timestamp = $ret; } else { $error = true; } } $date = date("j F Y H:i:s (r)", $timestamp); /* ============================================================ */ /* Page output */ /* ============================================================ */ ?>
Error: Invalid input string
UNIX timestamp: =$timestamp?>
Date: =$date?>
Convert UNIX timestamp to date or date to UNIX timestamp: