Not sure if you need the names of the months, but if you just want to use the translated names for several months, strftime()
uses the names according to the current locale (use the %B
modifier).
If you need a list of month names for other uses, you can also use strftime()
for this:
$months = array(); for( $i = 1; $i <= 12; $i++ ) { $months[ $i ] = strftime( '%B', mktime( 0, 0, 0, $i, 1 ) ); }
There may be a native function for the second question, but this is not difficult to do:
$currentDate = strftime( '%x', strtotime( '2011-12-13' ) ); $localFormat = str_replace( array( '13', '12', '2011', '11' ), array( 'DD', 'MM', 'YYYY', 'YY' ), $currentDate );
source share