Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/12/2008, 11:48
Avatar de Muzztein
Muzztein
 
Fecha de Ingreso: agosto-2002
Ubicación: Hangar 18
Mensajes: 1.703
Antigüedad: 22 años, 8 meses
Puntos: 16
Respuesta: Problema al buscar por fecha

aburrido de estas tonteras, hace tiempo que decidi guardar las fechas en mi propio formato.
que es del tipo YYYYMMDDHHMMSS

te dejo dos funciones que ami me han solucionado la vida de manera cosiderable.

creo que tb las puse en las biblioteca de funciones... ya no recuerdo

Código PHP:
function dateToIwsDate(str)
    
DIM ANO,MES,DIA,HORA,MINUTO,SEGUNDO
    
if isdate(str) = true then
        ano 
year(str)
        
mes month(str)
        
dia day(str)
        
horahour(str)
        
minuto minute(str)
        
segundo second(str)
        if 
len(ano) < 4 then ano "20" ano
        
if len(mes) < 2 then mes "0" mes
        
if len(dia) < 2 then dia "0" dia
        
if len(hora) < 2 then hora "0" hora
        
if len(minuto) < 2 then minuto "0" minuto
        
if len(segundo) < 2 then segundo "0" segundo
        dateToIwsDate 
ano&mes&dia&hora&minuto&segundo
    
else
        
dateToIwsDate"19000101000000"
    
end if
end function


function 
iwsDateToDate(str)
    
DIM ANO,MES,DIA,HORA,MINUTO,SEGUNDO,X_FECHA
    
if len(str) = 14 then
        ano 
left(str,4)
        
mes mid(str,5,2)
        
dia mid(str,7,2)
        
hora mid(str,9,2)
        
minuto mid(str,11,2)
        
segundo right(str,2)
        
x_fecha ano "/" mes "/" dia " " hora ":" minuto ":" segundo
        
if isdate(x_fecha) = true then
            iwsDateToDate 
cstr(x_fecha)
        else
            
iwsDateToDate iwsDateToDate("19000101000000")
        
end if
    else
        
iwsDateToDate iwsDateToDate("19000101000000")
    
end if
end function 
checala asi

response.write dateToIwsDate(now)