Skip to content

Instantly share code, notes, and snippets.

@fightbulc
Created August 18, 2015 18:29
Show Gist options
  • Save fightbulc/54cb41121fe39c3d9756 to your computer and use it in GitHub Desktop.
Save fightbulc/54cb41121fe39c3d9756 to your computer and use it in GitHub Desktop.
moment test
<?php
require 'vendor/autoload.php';
date_default_timezone_set('America/Chicago');
// Using Moment -- https://github.com/fightbulc/moment.php
$m = new \Moment\Moment('now', 'CST');
// Correct month 03 (March)
echo $m->format() . "\n";
// Wrong month, says "April"
echo $m->format('l, dS F Y / H:i (e)') . "\n";
// Using plain php date -- http://php.net/manual/en/function.date.php
// Correct month March
$date = date('l, dS F Y / H:i (e)');
echo $date . "\n";
{
"require": {
"fightbulc/moment": "~1.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment