Created
April 21, 2011 08:43
-
-
Save jamesmoss/933995 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 0:00 1/1/2011 UTC | |
$some_time = 1293840000; | |
$some_timezone = 'Europe/Moscow'; | |
date_default_timezone_set($some_timezone); | |
require('Twig/lib/Twig/Autoloader.php'); | |
Twig_Autoloader::register(); | |
$loader = new Twig_Loader_String(); | |
$twig = new Twig_Environment($loader); | |
$template = $twig->loadTemplate("TWIG: The time in {{ some_timezone }} at 0:00 1/1/2011 UTC was: {{ some_time|date('r') }}"); | |
header('Content-type: text/plain'); | |
var_dump($template->render(array('some_time' => $some_time, 'some_timezone' => $some_timezone))); | |
var_dump('NATIVE: The time in '.$some_timezone.' at 0:00 1/1/2011 UTC was: '.date('r', $some_time)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment