[imp] Change time format to AM/PM or 24hours

Santiago Romero sromero@servicom2000.com
Tue, 28 Aug 2001 14:02:10 +0200


El mar, 28 de ago de 2001, a las 12:10:08 +0200, Jan Schneider dijo:
> > >  Another related question... is there any function to format the
> > >  message date displayed on message.php3 (on the Date: field when you
> > >  read a message) so that it translates the date to spanish?
> > > 
> > >  (Mon, 23 Jun 2001) -> Lun, 23 Jun 2001
> > 
> >  I think I'll need to write this by myself (no problem)...
> 
> Use setlocale(LC_TIME, 'es_ES') before strftime()

 Well, that's an archaic HPUX O.S. with no spanish locales :(
 (I haven't tested it but I imagine it wouldn't work).

 I did the following:

function traducir_fecha($cadena)
{ 
  $cuantos = 0;
  $tok = strtok ($cadena," ");
  while ($tok)
  { 
    $cuantos++;
    // traducir las horas
         if( $tok == "Mon," )    echo "Lunes,";
    else if( $tok == "Tue," )    echo "Martes, ";
    else if( $tok == "Wed," )    echo "Miercoles, ";
    else if( $tok == "Thu," )    echo "Jueves, ";
    else if( $tok == "Fri," )    echo "Viernes, ";
    else if( $tok == "Sat," )    echo "Sabado, ";
    else if( $tok == "Sun," )    echo "Domingo, ";
    // Ahora los meses:
    else if( $tok == "Jan" )     echo "de Enero ";
    else if( $tok == "Feb" )     echo "de Febrero ";
    else if( $tok == "Mar" )     echo "de Marzo ";
    else if( $tok == "Apr" )     echo "de Abril ";
    else if( $tok == "May" )     echo "de Mayo ";
    else if( $tok == "Jun" )     echo "de Junio ";
    else if( $tok == "Jul" )     echo "de Julio ";
    else if( $tok == "Aug" )     echo "de Agosto ";
    else if( $tok == "Sep" )     echo "de Septiembre ";
    else if( $tok == "Oct" )     echo "de Octubre ";
    else if( $tok == "Nov" )     echo "de Noviembre ";
    else if( $tok == "Dec" )     echo "de Diciembre ";
    else echo $tok;
    echo " ";
    if( $cuantos < 5 )           $tok = strtok (" ");
    else                         $tok = "";
  }
}

/*
$micadena = "Mon, 27 Aug 2001 16:42:52 +0200 (METDST)";
traducir_fecha($micadena);
*/

 I changed echo $dat by traducir_fecha($dat) on 
 horde/imp/templates/message/headers.inc and worked perfectly.
 I hope the above code does not contain any bug that appears
 while I am on holidays :)

 CU and thanks a lot!

> >  anyway, Do my messages reach the list? Do you all read me? :?
> 
> Of course, why not? ;-)

 I don't know :) 

-- 
Santiago Romero
Departamento de Sistemas
sromero@servicom2000.com

Av. Primado Reig 189, entlo
46020 Valencia - Spain
Telf. (+34) 96 332 12 00
Fax. (+34) 96 332 12 01
http://www.servicom2000.com