PHP/Development/getdate — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 10:37, 26 мая 2010
Содержание
- 1 Acquiring Date Information with getdate()
- 2 getdate(): Day of the month
- 3 getdate(): Day of the week
- 4 getdate(): Day of the week (name)
- 5 getdate(): Day of year
- 6 getdate(): Hours of the day
- 7 getdate(): Minutes past the hour
- 8 getdate(): Month of the year
- 9 getdate(): Month of the year (name)
- 10 getdate(): Seconds past the minutes
- 11 getdate(): Timestamp
- 12 getdate(): Year (4 digits)
Acquiring Date Information with getdate()
<html>
<head>
<title>Acquiring date information with getdate()</title>
</head>
<body>
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
?>
<hr>
<?
print "Today"s date: $date_array[mday]/$date_array[mon]/$date_array[year]<p>";
?>
</body>
</html>
getdate(): Day of the month
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[mday]";
?>
getdate(): Day of the week
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[wday]";
?>
getdate(): Day of the week (name)
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[weekday]";
?>
getdate(): Day of year
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[yday]";
?>
getdate(): Hours of the day
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[hours]";
?>
getdate(): Minutes past the hour
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[minutes]";
?>
getdate(): Month of the year
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[mon]";
?>
getdate(): Month of the year (name)
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[month]";
?>
getdate(): Seconds past the minutes
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[seconds]";
?>
getdate(): Timestamp
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[0]";
?>
getdate(): Year (4 digits)
<?php
$date_array = getdate();
foreach ( $date_array as $key => $val ){
print "$key = $val<br>";
}
print "Today"s date: $date_array[year]";
?>