Skip to content

Instantly share code, notes, and snippets.

@sharkpp sharkpp/php-strftime.php
Last active May 28, 2016

What would you like to do?
// The MIT License (MIT)
// Copyright (c) 2016 sharkpp.
// See:
ini_set('date.timezone', 'Asia/Tokyo');
$timestamp = isset($argv[1]) ? (int)$argv[1] : mktime(23, 45, 58, 2, 29, 2004);
foreach ([
// ほかの言語と同様に出力できるフォーマット
'%a, %d %b %Y %T %z',
] as $fmt)
echo $fmt . '@@' . ('%P' == $fmt ? strtolower(strftime('%p', $timestamp)) : // ※ Mac OS X 用のfix
strftime($fmt, $timestamp)) . '@~';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.