Home Tutorial Php Phpdate date_format()

 
 

Share on Google+Share on Google+
date_format()
Posted on: August 26, 2009 at 12:00 AM
Advertisement
date_format alias DateTime::format function returns date formatted according to given format. It returns formatted date on success otherwise False on failure.

date_format()

date_format alias DateTime::format function returns date formatted according to given format. It returns formatted date on success otherwise False on failure.

Description on date_format() PHP

public string DateTime::format ( string $format )
string date_format ( DateTime $object , string $format )

Parameters of PHP Date Format

object - Procedural style only: A DateTime object returned by date_create()

format - Format accepted by date().

Examples of PHP Date Formatting

<?php
date_default_timezone_set('India/Kolkata');

$datetime = date_create('2009-08-24 16:42:10');
echo date_format($datetime, 'jS, F Y') . "\n";
echo date_format($datetime, DATE_ATOM);
?>

Advertisement

Related Tags for date_format():


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com