Foros del Web » Programando para Internet » Javascript »

Dudas Con Formato Fecha

Estas en el tema de Dudas Con Formato Fecha en el foro de Javascript en Foros del Web. HOLA AMIGOS TENGO UNA PEQUEÑA DUDA, ESTOY UTILIZANDO UN CALENDARIO EN JAVASCRIPT (CUT & PASTE DATE TIME PICKER), BUENO EL ASUNTO ES QUE ME TIRA ...
  #1 (permalink)  
Antiguo 03/06/2005, 09:16
Avatar de kyo1982  
Fecha de Ingreso: mayo-2005
Mensajes: 71
Antigüedad: 19 años
Puntos: 0
Exclamación Dudas Con Formato Fecha

HOLA AMIGOS TENGO UNA PEQUEÑA DUDA, ESTOY UTILIZANDO UN CALENDARIO EN JAVASCRIPT (CUT & PASTE DATE TIME PICKER), BUENO EL ASUNTO ES QUE ME TIRA ESTO 6/15/2005 (MM/DD/YYYY) Y YO QUIERO QUE ME TIRE ESTO 06/15/2005, YA ME FIJE EL JAVASCRIPT PERO NO TENGO NI IDEA DE JAVA, SI ALGUIEN ME PUEDE DAR UN CONSEJO, AQUI LES PONGO LA SENTENCIA DEL JAVA LA DE LOS MESES, ESPERO SU AYUDA SUPERHEROES DEL WEB.

CODIGO
************************************************
function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
{
Cal=new Calendar(dtToday);
if ((pShowTime!=null) && (pShowTime))
{
Cal.ShowTime=true;
if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))
{
TimeMode=pTimeMode;
}
}
if (pCtrl!=null)
Cal.Ctrl=pCtrl;
if (pFormat!=null)
Cal.Format=pFormat.toUpperCase();

exDateTime=document.getElementById(pCtrl).value;
if (exDateTime!="")//Parse Date String
{
var Sp1;//Index of Date Separator 1
var Sp2;//Index of Date Separator 2
var tSp1;//Index of Time Separator 1
var tSp1;//Index of Time Separator 2
var strMonth;
var strDate;
var strYear;
var intMonth;
var YearPattern;
var strHour;
var strMinute;
var strSecond;
//parse month
Sp1=exDateTime.indexOf(DateSeparator,0)
Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1 )+1));

if ((Cal.Format.toUpperCase()=="DDMMYYYY") || (Cal.Format.toUpperCase()=="DDMMMYYYY"))
{
strMonth=exDateTime.substring(Sp1+1,Sp2);
strDate=exDateTime.substring(0,Sp1);
}
else if ((Cal.Format.toUpperCase()=="MMDDYYYY") || (Cal.Format.toUpperCase()=="MMMDDYYYY"))
{
strMonth=exDateTime.substring(0,Sp1);
strDate=exDateTime.substring(Sp1+1,Sp2);
}
if (isNaN(strMonth))
intMonth=Cal.GetMonthIndex(strMonth);
else
intMonth=parseInt(strMonth,10)-1;
if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))
Cal.Month=intMonth;
//end parse month
//parse Date
if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))
Cal.Date=strDate;
//end parse Date
//parse year
strYear=exDateTime.substring(Sp2+1,Sp2+5);
YearPattern=/^\d{4}$/;
if (YearPattern.test(strYear))
Cal.Year=parseInt(strYear,10);
//end parse year
//parse time
if (Cal.ShowTime==true)
{
tSp1=exDateTime.indexOf(":",0)
tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
strHour=exDateTime.substring(tSp1,(tSp1)-2);
Cal.SetHour(strHour);
strMinute=exDateTime.substring(tSp1+1,tSp2);
Cal.SetMinute(strMinute);
strSecond=exDateTime.substring(tSp2+1,tSp2+3);
Cal.SetSecond(strSecond);
}
}

************************************************
__________________
Gracias TOTALES :-D
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:10.