Unix and Linux Discussions Tagged with date format |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
4 |
23,396 |
Shell Programming and Scripting |
|
|
|
4 |
18,113 |
Shell Programming and Scripting |
|
|
|
1 |
19,560 |
Shell Programming and Scripting |
|
|
|
1 |
6,426 |
Shell Programming and Scripting |
|
|
|
14 |
3,771 |
Shell Programming and Scripting |
|
|
|
4 |
7,584 |
Shell Programming and Scripting |
|
|
|
1 |
2,149 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
8,009 |
Shell Programming and Scripting |
|
|
|
4 |
18,330 |
Shell Programming and Scripting |
|
|
|
1 |
4,392 |
Shell Programming and Scripting |
|
|
|
7 |
5,745 |
Shell Programming and Scripting |
|
|
|
2 |
1,936 |
Shell Programming and Scripting |
|
|
|
2 |
1,849 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
1,860 |
Shell Programming and Scripting |
|
|
|
4 |
2,927 |
Shell Programming and Scripting |
|
|
|
1 |
1,919 |
Shell Programming and Scripting |
|
|
|
5 |
2,697 |
Shell Programming and Scripting |
|
|
|
4 |
7,808 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,106 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
17,735 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
3,148 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
6,300 |
UNIX for Advanced & Expert Users |
|
|
|
3 |
3,551 |
UNIX for Dummies Questions & Answers |
DATETIMEIMMUTABLE.FORMAT(3) 1 DATETIMEIMMUTABLE.FORMAT(3)
DateTime::format - Returns date formatted according to given format
Object oriented style
SYNOPSIS
public string DateTime::format (string $format)
DESCRIPTION
string DateTimeImmutable::format (string $format) string DateTimeInterface::format (string $format)
Procedural style
string date_format (DateTimeInterface $object, string $format)
Returns date formatted according to given format.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3)
o $format
- Format accepted by date(3).
RETURN VALUES
Returns the formatted date string on success or FALSE on failure.
EXAMPLES
Example #1
DateTimeImmutable.format(3) example
Object oriented style
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Procedural style
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
The above example will output:
2000-01-01 00:00:00
NOTES
This method does not use locales. All output is in English.
SEE ALSO
date(3).
PHP Documentation Group DATETIMEIMMUTABLE.FORMAT(3)