Hallo!
Mal wieder ein kleines Script von mir.
Die Überschrift sagt eigentlich schon alles
PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-style-type" content="text/css">
<style>
body{font-family:verdana, arial, sans-serif;}
.main{width:45%; border:solid 2px #000000;}
.field{width:45%; border:solid 2px #000000; background-color:#CCCCCC;}
.done{width:70%; border:solid 2px #006600; padding:5px; background-color:#FFFFFF;}
.small{font-size:12px;}
</style>
<title>Unix-Zeit berechnen</title>
</head><body><center>
<?php
if (isset($_POST['timestamp'])){
$settimestamp = $_POST['settimestamp'];
if (empty($settimestamp))
{
$settimestamp = '0';
$timestampoutput = '0';
}
else{
$timestampoutput = date("d.m.Y, H:i:s", $settimestamp);
}
$done1 = 'done';
$field1 = 'field';
}
else{
$field1 = 'main';
}
if (isset($_POST['normaltime'])){
$setday = $_POST['setday'];
$setmonth = $_POST['setmonth'];
$setyear = $_POST['setyear'];
$sethour = $_POST['sethour'];
$setminute = $_POST['setminute'];
$setsecond = $_POST['setsecond'];
if (empty($setday)){$setday = '01';}
if (empty($setmonth)){$setmonth = '01';}
if (empty($setyear)){$setyear = '1970';}
if (empty($sethour)){$sethour = '00';}
if (empty($setminute)){$setminute = '00';}
if (empty($setsecond)){$setsecond = '00';}
$normaltimeoutput = strtotime(date ("dMYHis", mktime($sethour,$setminute,$setsecond,$setmonth,$setday,$setyear)));
$done2 = 'done';
$field2 = 'field';
$input = $setday.'.'.$setmonth.'.'.$setyear.', '.$sethour.':'.$setminute.':'.$setsecond;
}
else{
$field2 = 'main';
}
echo'<h2><u>Aktuelle Unix-Zeit</u></h2>'.date("d.m.Y, H:i:s", time()).'<br><br><b>'.time().'</b><br><br>
<h2><u>Timestamp berechnen:</u></h2>
<div class="'.$field1.'">
<p>
UNIX -> Normalzeit:<br>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
Timestamp eingeben: <input type="text" name="settimestamp" size="30">
<p><input type="submit" name="timestamp" value="Berechnen"></p>
</form>
<div class="'.$done1.'">Ergebnis: <b>'.$timestampoutput.'</b></div>';
if (isset($_POST['timestamp'])){echo'(Eingabe: '.$settimestamp.')';}
echo'</p>
</p>
</div>
<br><br>
<a name="norm">
<div class="'.$field2.'">
<p>
Normalzeit -> UNIX:<br>
<form action="'.$_SERVER['PHP_SELF'].'#norm" method="post">
Normalzeit eingeben:<br>
<input type="text" name="setday" size="1">.<input type="text" name="setmonth" size="1">.<input type="text" name="setyear" size="2">
, <input type="text" name="sethour" size="1">:<input type="text" name="setminute" size="1">:<input type="text" name="setsecond" size="1">
<p><input type="submit" name="normaltime" value="Berechnen"></p>
</form>
<div class="'.$done2.'">Ergebnis: <b>'.$normaltimeoutput.'</b></div>';
if (isset($_POST['normaltime'])){echo'(Eingabe: '.$input.')';}
echo'</p>
</p>
</div>
<br><br><br>
<div class="small">Script written by Donkey</div>';
?>
</center>
</body></html>
Alles anzeigen
Demo: http://kendo-bunker.de/donkey/timestamp.php
Gruss, Donkey