<?php
    $lastmod 
"13.03.2005 01:45";
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Timestamp von Jens Becker</title>
    <link rel="Stylesheet" type="text/css" href="../php.css" />
</head>
<body>
<p><a href="http://www.intermitto.net/loesungen/skripte/timestamp/">Zurück zum Artikel</a></p>

<h1>Timestamp v1.2.8 &copy; Jens Becker</h1>

<h2>Was ist Timestamp?</h2>
<p>Dieses Programm wandelt einen beliebigen Zeitpunkt in einen UNIX-Timestamp oder umgekehrt um.</p>

<table width="90%" align="center">
    <tr>
        <td width="50%">


<form method="post" action="./">
<table>
    <tr>
        <td width="200">Tag</td>
        <td width="200"><input type="text" name="datum[d]" value="<?php if(isset($_POST["datum"]["d"])) { echo $_POST["datum"]["d"]; } else { echo date("d"); } ?>" /></td>
    </tr>
    <tr>
        <td>Monat</td>
        <td><input type="text" name="datum[m]" value="<?php if(isset($_POST["datum"]["m"])) { echo $_POST["datum"]["m"]; } else { echo date("m"); } ?>" /></td>
    </tr>
    <tr>
        <td>Jahr</td>
        <td><input type="text" name="datum[Y]" value="<?php if(isset($_POST["datum"]["Y"])) { echo $_POST["datum"]["Y"]; } else { echo date("Y"); } ?>" /></td>
    </tr>
    <tr>
        <td>Stunde</td>
        <td><input type="text" name="datum[H]" value="<?php if(isset($_POST["datum"]["H"])) { echo $_POST["datum"]["H"]; } else { echo "0"; } ?>" /></td>
    </tr>
    <tr>
        <td>Minute</td>
        <td><input type="text" name="datum[i]" value="<?php if(isset($_POST["datum"]["i"])) { echo $_POST["datum"]["i"]; } else { echo "0"; } ?>" /></td>
    </tr>
    <tr>
        <td>Sekunde</td>
        <td><input type="text" name="datum[s]" value="<?php if(isset($_POST["datum"]["s"])) { echo $_POST["datum"]["s"]; } else { echo "0"; } ?>" /></td>
    </tr>
    <tr>
        <td colspan="2" align="center"><input type="submit" value="Umwandeln in Timestamp" /></td>
    </tr>
</table>
</form>

<hr />

<form method="post" action="./">
<table>
    <tr>
        <td width="200">Timestamp</td>
        <td width="200"><input type="text" name="stamp" value="<?php if(isset($_POST["stamp"])) { echo $_POST["stamp"]; } ?>" /></td>
    </tr>
    <tr>
        <td colspan="2" align="center"><input type="submit" value="Umwandeln in Datum" /></td>
    </tr>
</table>
</form>

<hr />

<form method="post" action="./">
<p>Das dritte Formular dient einem speziellen Zweck...</p>
<table>
    <tr>
        <td width="200">Datum im Format DDMMYY-HHMMSS</td>
        <td width="200"><input type="text" name="lz" value="<?php if(isset($_POST["lz"])) { echo $_POST["lz"]; } ?>" /></td>
    </tr>
    <tr>
        <td colspan="2" align="center"><input type="submit" value="Umwandeln in Timestamp" /></td>
    </tr>
</table>
</form>

        </td>
        <td width="50%" align="center">

<?php
if(isset($_POST["datum"])) {
    echo 
"<p>Ergebnis:</p>";
    echo 
"<p><input type=\"text\" size=\"100\" value=\"".mktime($_POST["datum"]["H"],$_POST["datum"]["i"],$_POST["datum"]["s"],$_POST["datum"]["m"],$_POST["datum"]["d"],$_POST["datum"]["Y"])."\" /></p>";
} elseif(isset(
$_POST["stamp"])) {
    echo 
"<p>Ergebnis:</p>";
    echo 
"<p><input type=\"text\" size=\"100\" value=\"".date("d.m.Y H:i:s",$_POST["stamp"])."\" /></p>";
} elseif(isset(
$_POST["lz"])) {
    
$tag substr($_POST["lz"], 02);
    
$monat substr($_POST["lz"], 22);
    
$jahr "20".substr($_POST["lz"], 42);
    
$stunde substr($_POST["lz"], 72);
    
$minute substr($_POST["lz"], 92);
    
$sekunde substr($_POST["lz"], 112);
    echo 
"<p>Ergebnis:</p>";
    echo 
"<p><input type=\"text\" size=\"100\" value=\"".mktime($stunde,$minute,$sekunde,$monat,$tag,$jahr)."\" /></p>";
}
?>

        </td>
    </tr>
</table>

<?php
include("../footer.inc.php");
?>

</body>
</html>