Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3594722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:45:09+00:00 2026-05-18T19:45:09+00:00

If I have a month name in a certain language(let’s say Albanian), how do

  • 0

If I have a month name in a certain language(let’s say Albanian), how do I get the number corresponding to it (in PHP)? Besides the obvious method of making an array with the month names of that language (I’m afraid that’s quite vulnerable to spelling mistakes) I presume that you can use setlocale but I can’t figure out what to do next.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:45:09+00:00Added an answer on May 18, 2026 at 7:45 pm

    I may be wrong but, as far as I know, you can use locales to generate month names but there aren’t builtin date functions that are able to parse non-English names.

    It should be fairly easy to generate a list of names to compare against:

    <?php
    
    $langs = array(
        // Windows only locale names
        'Albanian',
        'French',
        'German',
        'Spanish',
    );
    $months = array();
    
    foreach($langs as $lang){
        setlocale(LC_TIME, $lang);
        foreach(range(1, 12) as $i){
            $months[$lang][$i] = strftime('%B', mktime(0, 0, 0, $i));
        }
    }
    

    However, it’s possible that there’re alternative spellings in some languages so the reliability of this method actually depends on your exact needs.

    PHP has some Internationalization Functions that might be a better bet. The IntlDateFormatter::parse() method appears to do exactly what you are asking. However, its requirements include PHP 5 >= 5.3.0, PECL intl >= 1.0.0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display a yearly report based on month, let say I have
How can I get the month name from the month number? For instance, if
Possible Duplicate: iOS: How to get a proper Month name from a number? How
Possible Duplicate: convert month from name to number I have a simple (yet interesting)
I have 3 collection datatable that shows in this below Month: January ID NAME
I have a directory full of log files in the form ${name}.log.${year}{month}${day} such that
I have to add one month to todays date and have to get date
I know that SQLite doesn't support day name and month name. I have gone
I am trying to convert string month name to month number, but why do
I am trying to figure out how to get month name from a month

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.