Get locale date format?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RussellEngland
Forum Newbie
Posts: 8
Joined: Thu Nov 11, 2010 3:58 pm

Get locale date format?

Post by RussellEngland »

Going round in circles with this. If I use setlocale(LC_ALL,'en_GB'), how do I get the date format as a string?

Code: Select all

setlocale(LC_ALL, 'en_GB');

$format=???? // dd/mm/yy

$time="29/12/65"; 

$isodate = date_create_from_format( $format,  $time);

$isodate = date_format( $isodate , ISO8601 );

echo $isodate
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Get locale date format?

Post by AbraCadaver »

Need 5.3 unless there is another way: datefmt_get_pattern()
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply