Replaced strftime with IntlDateFormatter (#1286)
This commit is contained in:
parent
fd48bcbf69
commit
656767aa16
|
@ -25,6 +25,22 @@ function printMoney($amt, $info)
|
|||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
function printCal($date)
|
||||
{
|
||||
$loc = setlocale(LC_TIME, 0);
|
||||
$fmt = datefmt_create(
|
||||
$loc,
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::FULL,
|
||||
'America/Los_Angeles',
|
||||
IntlDateFormatter::GREGORIAN
|
||||
);
|
||||
datefmt_set_pattern($fmt, 'cccc');
|
||||
echo datefmt_format($fmt, $date) . PHP_EOL;
|
||||
datefmt_set_pattern($fmt, 'MMMM');
|
||||
echo datefmt_format($fmt, $date) . PHP_EOL;
|
||||
}
|
||||
|
||||
require_once('MsSetup.inc');
|
||||
|
||||
$setLocaleInfo = ($_SERVER['argv'][1]);
|
||||
|
@ -90,8 +106,8 @@ if ($sep !== $info['thousands_sep']) {
|
|||
$n1 = 10000.98765;
|
||||
printMoney($n1, $info);
|
||||
|
||||
echo strftime("%A", strtotime("12/25/2020")) . PHP_EOL;
|
||||
echo strftime("%B", strtotime("12/25/2020")) . PHP_EOL;
|
||||
$d = new DateTime("12/25/2020", new DateTimeZone('America/Los_Angeles'));
|
||||
printCal($d);
|
||||
|
||||
try {
|
||||
$conn = new PDO("sqlsrv:server = $server; database=$databaseName; driver=$driver", $uid, $pwd );
|
||||
|
|
|
@ -30,6 +30,22 @@ function printMoney($amt, $info)
|
|||
}
|
||||
}
|
||||
|
||||
function printCal($date)
|
||||
{
|
||||
$loc = setlocale(LC_TIME, 0);
|
||||
$fmt = datefmt_create(
|
||||
$loc,
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::FULL,
|
||||
'America/Los_Angeles',
|
||||
IntlDateFormatter::GREGORIAN
|
||||
);
|
||||
datefmt_set_pattern($fmt, 'cccc');
|
||||
echo datefmt_format($fmt, $date) . PHP_EOL;
|
||||
datefmt_set_pattern($fmt, 'MMMM');
|
||||
echo datefmt_format($fmt, $date) . PHP_EOL;
|
||||
}
|
||||
|
||||
require_once('MsSetup.inc');
|
||||
|
||||
$setLocaleInfo = ($_SERVER['argv'][1]);
|
||||
|
@ -96,8 +112,8 @@ if ($sep !== $info['thousands_sep']) {
|
|||
$n1 = 10000.98765;
|
||||
printMoney($n1, $info);
|
||||
|
||||
echo strftime("%A", strtotime("12/25/2020")) . PHP_EOL;
|
||||
echo strftime("%B", strtotime("12/25/2020")) . PHP_EOL;
|
||||
$d = new DateTime("12/25/2020", new DateTimeZone('America/Los_Angeles'));
|
||||
printCal($d);
|
||||
|
||||
$conn = sqlsrv_connect($server, $connectionOptions);
|
||||
if (!$conn) {
|
||||
|
|
Loading…
Reference in a new issue