Skip to content

Instantly share code, notes, and snippets.

@fightbulc
Created August 18, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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