Months are currently displayed as numbers (01/01/2014). I want to display as full month name (01 Janvier 2014).
Here is the code that seems to control date format display for US or else International (French and Spanish) date format and month names:

 // format date for display only
        if(AC_DATE_DISPLAY_FORMAT=="us")    $date_format    =   $month." ".$day_counter.", ".$year;

        else $date_format = $day_counter." ".$month." ".$year;

I have read and made many unsucessful trials to get $month to ouput a month name.
In particulr, I have tried the following unsuccessful modifications

$date_format    =   $day_counter." ".$month = date("F")."  ".$year;
or
$date_format    = $day_counter." ".$month = mktime(0, 0, 0, date("d"), date("F"), date("Y"))."  ".$year;
or

$date_format = $day_counter." ".$month=date('F', strtotime("2000-$month-01"))." ".$year;
or
$date_format = $day_counter." ".$month=(date('F',$date_timestamp))." ".$year;
or
$date_format = date("j F Y");

or adding this line above
$month = date("F");
or putting this after set_local
echo strftime('%B', $timestamp);

If I were a php coder I would know the answer, but the more I read PHP manual and this and other formers "answers", which I try to implement, the more obscure.

Would anyone have a clue why I cannot change the integer to monthname for same?
Assistance is appreciated.
asimegusta

Member Avatar for diafol
setlocale(LC_ALL, 'French');
$datetime = '01/01/2014';
$d = new DateTime($datetime);
echo strftime("%d %B %Y", $d->format('U'));

Heh,
Thank you trying to help. I put the code you suggest at the beginning of the file. The result is that it outputs January 1, 2014 at the top og the page and within the calendar month headers.
The dates that are clicked on the calendar still display in form as numbers only.

I just solved this, that is how to display month name in place of number in dates, with help from another forum. In case it may be of use to someone else trying to format dates for international, here's the new code:

//   format date for display only
        if(AC_DATE_DISPLAY_FORMAT=="us")
            $date_format  = strftime('%B %d %Y', strtotime("".$month."/".$day_counter."/".$year.""));
// format for FR and ES
        else $date_format  =  strftime('%d %B %Y', strtotime("".$month."/".$day_counter."/".$year.""));

Happy Coding!

Member Avatar for diafol

I put the code you suggest at the beginning of the file. The result is that it outputs January 1, 2014 at the top og the page and within the calendar month headers.
The dates that are clicked on the calendar still display in form as numbers only.

I'm afraid I don't understand what you're trying to do.

AC_DATE_DISPLAY_FORMAT

Where does this come from?

Anyway, if my code did not print out janvier, there may be something wrong with your system. The set_locale() with LC_ALL should convert dates to the language specified.

Glad you got it sorted though - but I'm confused as to why you have 3 parts to the date you wish to convert. A datepicker or date field in a form should just pass the full date.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.