Date function returning month in en [duplicate]

1

Is there any form of function date returning the current month in pt-br?

Example: ["Jan", "Fev", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Set", "Out", "Nov", " / p>     

asked by anonymous 05.06.2017 / 23:30

1 answer

3

example - ideone

strftime - Formats a time / date according to local settings

%b brings abbreviated month link

setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
echo strftime('%b', strtotime('today'));
  

If you just want to set the dates just change LC_ALL to LC_TIME

The setlocale function is responsible for specifying the type of locale you want to perform operations for a category. The first parameter represents the category of operations, and should be valid one of the constants below:

LC_COLLATE - para especificar as regras da localidade para comparação de textos.
LC_CTYPE - para especificar as regras da localidade para classificação/conversão de caracteres.
LC_MONETARY - para especificar a notação monetária de uma localidade.
LC_NUMERIC - para especificar a notação numérica de uma localidade.
LC_TIME - para especificar a notação de data/tempo de uma localidade.
LC_MESSAGES - para especificar o idioma das mensagens de log.
LC_ALL - para especificar a localidade para todas as categorias.

The second parameter must be a string, with the locale name according to the operating system. This is because the setlocale function uses the locale definitions defined on the server, including its name.

For example, in Linux, we can install locale definitions for Brazilian Portuguese and modify locale rules with the string "pt_BR", while in Windows the string can be "Portuguese_Brazil". The charset is also important, as some operations depend on it.

We can pass a third, fourth, fifth parameter, etc. for the setlocale function, specifying several possible locales. The first one to be found by the server is used. See the example:

setlocale(LC_ALL, 'pt_BR.UTF-8', 'Portuguese_Brazil.1252');
    
05.06.2017 / 23:41