Browse Source

Adding strtotime()

master
Annika Backstrom 7 years ago
parent
commit
e5ca49d3e8
  1. 25
      classes.php
  2. 1
      index.php

25
classes.php

@ -203,6 +203,31 @@ class ActionDateC extends AbstractAction
}
}
class ActionStrtotime extends AbstractAction
{
public function setUp()
{
$this->setContainer( new DivContainer );
$this->setFormatter( new EchoFormatter );
}
public function decode()
{
$tz = date_default_timezone_get();
date_default_timezone_set('UTC');
$time = strtotime($this->value);
$str_utc = date('c', $time);
date_default_timezone_set('America/New_York');
$str_ny = date('c', $time);
date_default_timezone_set($tz);
return "$time<br>$str_utc<br>$str_ny";
}
}
class ActionAnsi2Html extends AbstractAction
{
public function setUp()

1
index.php

@ -46,6 +46,7 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
<option value="JsonDecode" <?php echo selected($action_str, 'JsonDecode'); ?>>json_decode()</option>
<option value="JsonEncode" <?php echo selected($action_str, 'JsonEncode'); ?>>json_encode()</option>
<option value="DateC" <?php echo selected($action_str, 'DateC'); ?>>date('c', $timestamp)</option>
<option value="Strtotime" <?php echo selected($action_str, 'Strtotime'); ?>>strtotime()</option>
<option value="ParseStr" <?php echo selected($action_str, 'ParseStr'); ?>>parse_str()</option>
<option value="Ansi2Html" <?php echo selected($action_str, 'Ansi2HTml'); ?>>ansi-to-html</option>
<select>

Loading…
Cancel
Save