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.
38 lines
1.1 KiB
38 lines
1.1 KiB
3 months ago
|
#!/usr/bin/env php
|
||
|
<?php
|
||
|
/*
|
||
|
* PHP Skript zum Umrechnen von Datumsangaben (UNIX Timestamps)
|
||
|
* Author: Dominic Reich <quick.hat4396@qtztsjosmprqmgtunjyf.com>
|
||
|
* Last modified: Freitag, 02.11.2018 06:13
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* 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() );
|
||
|
};
|
||
|
?>
|
||
|
|