2011-04-24 4 views
0

PHPを使用してランタイム中にサーバの現在の日時を見つけるために使用できる関数は、この現在の日付と時刻をタグに渡す必要がありますRSSフィードの "日付/パブ日付の公開"PHPを使用してランタイムにサーバの現在の日付と時刻を見つけるために使用できる関数

質問がとても簡単な場合は、私を許してください。

よろしくお願いいたします。 Gourav。

答えて

2

date()またはgetdate()またはthe many other similar functions that PHP has for dealing with datesのいずれかです。

date()は、フォーマット文字列に基づいて日付を提供します。 several builtin format strings, including one for RSS DATE_RSSがあります。あなたはRSSが必要なものにそれをフォーマットすることができ、そこから

Array 
(
    [seconds] => 40 
    [minutes] => 58 
    [hours] => 21 
    [mday] => 17 
    [wday] => 2 
    [mon]  => 6 
    [year] => 2003 
    [yday] => 167 
    [weekday] => Tuesday 
    [month] => June 
    [0]  => 1055901520 
) 

getdate()はあなたにほとんどすべての必要な情報のを含む連想配列を与えるだろう。

0
$today = date("F j, Y, g:i a");     // March 10, 2001, 5:16 pm 
$today = date("m.d.y");       // 03.10.01 
$today = date("j, n, Y");      // 10, 3, 2001 
$today = date("Ymd");       // 20010310 
$today = date('h-i-s, j-m-y, it is w Day');  // 05-16-18, 10-03-01, 1631 1618 6 Satpm01 
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day. 
$today = date("D M j G:i:s T Y");    // Sat Mar 10 17:16:18 MST 2001 
$today = date('H:m:s \m \i\s\ \m\o\n\t\h');  // 17:03:18 m is month 
$today = date("H:i:s");       // 17:16:18 
関連する問題