Adding strtotime()

This commit is contained in:
Annika Backstrom 2014-09-03 09:09:17 -04:00
parent d3917a1c24
commit e5ca49d3e8
2 changed files with 26 additions and 0 deletions

View File

@ -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()

View File

@ -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>