Jump to content
SilvaPT

Função de Data (Portugues)

Recommended Posts

SilvaPT

Eu criei esta função de data para mostrar a data, dia e més.
O problema é que mostra o més em Ingles..

exemplo: March, 10, 2018".

Como faço para que ele leia em Português tipo "Março, 10, 2018?

function dateName($date) {

    $result = "";

    $convert_date = strtotime($date);
    $month = date('F',$convert_date);
    $year = date('Y',$convert_date);
    $name_day = date('l',$convert_date);
    $day = date('j',$convert_date);


    $result = $month . " " . $day . ", " . $year;

    return $result;
}

Ajudinha sff gente.

Share this post


Link to post
Share on other sites
HappyHippyHippo

Porque não usar directamente a função date? Essa função é desnecessária 


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
toarelli

Amigo um script que uso, mostra a Hora, Dia, Mês e Ano.

Espero que ajude.

<?php

  <SCRIPT LANGUAGE="JAVASCRIPT">
      var now = new Date();
      var mName = now.getMonth() +1 ;
      var dName = now.getDay() +1;
      var dayNr = now.getDate();
      var yearNr=now.getYear();
      if(dName==1) {Day = "Dom";}
      if(dName==2) {Day = "Seg";}
      if(dName==3) {Day = "Ter";}
      if(dName==4) {Day = "Qua";}
      if(dName==5) {Day = "Qui";}
      if(dName==6) {Day = "Sex";}
      if(dName==7) {Day = "Sab";}
      if(mName==1){Month = "01";}
      if(mName==2){Month = "02";}
      if(mName==3){Month = "03";}
      if(mName==4){Month = "04";}
      if(mName==5){Month = "05";}
      if(mName==6){Month = "06";}
      if(mName==7){Month = "07";}
      if(mName==8){Month = "08";}
      if(mName==9){Month = "09";}
      if(mName==10){Month = "10";}
      if(mName==11){Month = "11";}
      if(mName==12){Month = "12";}
      if(yearNr < 2000) {Year = 1900 + yearNr;}
      else {Year = yearNr;}
      var todaysDate =(" " + Day + ", " + dayNr + "/" + Month + "/" + Year + " - " );

      document.write('  '+todaysDate);

  </SCRIPT>

    
  <SPAN ID="Clock">00:00:00</SPAN>

  <SCRIPT LANGUAGE="JavaScript">

    var Elem = document.getElementById("Clock");
    function Horario(){ 
      var Hoje = new Date(); 
      var Horas = Hoje.getHours(); 
      if(Horas < 10){ 
        Horas = "0"+Horas; 
      } 
      var Minutos = Hoje.getMinutes(); 
      if(Minutos < 10){ 
        Minutos = "0"+Minutos; 
      } 
      var Segundos = Hoje.getSeconds(); 
      if(Segundos < 10){ 
        Segundos = "0"+Segundos; 
      } 
      Elem.innerHTML = Horas+":"+Minutos+":"+Segundos; 
      } 
      window.setInterval("Horario()",1000);

  </SCRIPT>

?>

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.