Welcome Guest, Not a member yet? Register   Sign In
How to set Date in dd.mm.yyyy format
#2

I have two functions, below, that I use in a help file. They are in Portuguese but it is easy to change to other languages, they are self-explanatory.;

In Portuguese we use the preposition 'de' - in English, 'of' - between the day, month and year:
02 de fevereiro of 2022 => if it were also used in English it would look like this: 02 of February of 2022.

PHP Code:
function diames() // diames = daymonth
{
    setlocale(LC_TIME'pt''portuguese');
    date_default_timezone_set('America/Sao_Paulo');

    return utf8_encode(strftime('%d de %B'strtotime('today')));

}

function 
daymonth() // daymonthyear = daymonthyear
{
    setlocale(LC_TIME'pt''portuguese');
    date_default_timezone_set('America/Sao_Paulo');

    return utf8_encode(strftime('%d de %B de %Y'strtotime('today')));
    

If plan A fails, relax... the alphabet is 26 letters
Reply


Messages In This Thread
RE: How to set Date in dd.mm.yyyy format - by wdeda - 02-01-2022, 08:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB