You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
2 years ago
|
#!/usr/bin/env php
|
||
|
<?php
|
||
|
/*
|
||
|
* PHP Skript zum Umrechnen von Datumsangaben (UNIX Timestamps)
|
||
|
* Author: Dominic Reich <dr@dark-fellow.info>
|
||
|
* Last modified: Freitag, 02.11.2018 06:13
|
||
|
* IRC: #idlorama @ Quakenet (http://www.quakenet.org)
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* THIS SCRIPT IS FOR COMMAND LINE (CLI) ONLY!!
|
||
|
* run with "php <script path & name>
|
||
|
* php date.php [options] [args]
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
if ( isset ( $argv[1] ) ) {
|
||
|
if ( !preg_match ( "/^[0-9]{10}$/", $argv[1] ) ) {
|
||
|
die ( "Ungültiger Timestamp!\n" );
|
||
|
/*
|
||
|
* TODO: delete this part, this is now implemented in regex above
|
||
|
} elseif ( strlen ( trim ( $argv[1] ) ) != 10 ) {
|
||
|
die ( "Ungültiger Timestamp!\n" );
|
||
|
*/
|
||
|
};
|
||
|
|
||
|
echo " Timestamp: $argv[1]\n";
|
||
|
echo " Date: " . date ( "d.m.Y H:i:s", $argv[1] );
|
||
|
// echo "Actual Timestamp: " . time() . "\n";
|
||
|
// echo " Actual Date: " . date ( "d.m.Y H:i:s", time() );
|
||
|
} else {
|
||
|
// Default: printing timestamp and calculate it to std date format (human readable)
|
||
|
echo "Actual Timestamp: " . time() . "\n";
|
||
|
echo " Actual Date: " . date ( "d.m.Y H:i:s", time() );
|
||
|
};
|
||
|
?>
|
||
|
|