Results 1 to 3 of 3

Thread: [RESOLVED] Format month

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Resolved [RESOLVED] Format month

    If the number is 4 then I want to convert it to month of april.
    I've tried strftime function but it accept the full date not just a number.

    strftime("%B", $date);


    How can I achieve that converting a single number into month?

    Thanks in advance for all help mate.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Format month

    Easiest way I can think of is to make an array with all months.

    PHP Code:
    $months = array(
      
    'January''February''March''April''May''June',
      
    'July''August''September''October''November''December'
    );

    $monthID 4;

    echo 
    $months[$monthID 1]; 

  3. #3

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Format month

    So there will be no other way in doing that?

    Well making an array is good enough. Thanks for the reply mate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width