Thursday, September 27, 2007

Check date in Java Script

here is my date check javascript.

function leapyearcheck(year)
{

if(year.value % 4 != 0)
{
return 0;
}

else
{
if(year.value % 100 != 0)
{
return 1; //leap year
}

else
{

if(year.value % 400 != 0)
{
return 0
}

else
return 1; //leap year

}

}
}


function datecheck(day,month,year) //call this function
{
//alert(day.value);

if(!leapyearcheck(year))
{
//alert("Not Leap Year");

if(month.value == 2)
{
if(day.value > 28)
{
alert("Check the Day and Month");
return false;
}

}
}

else

{

//alert("Leap Year");
if(month.value == 2)
{
if(day.value > 29)
{
alert("Check the Day and Month");
return false;
}
}

}


Thanks to HasinHyder for a tricky one..

var dt = new Date(year+"/02/29");
if (dt.getMonth()=="1")
alert (year + " is a leap year");
else
alert(year + " is not a leap year")



mdb file in OpenOffice.org

To work with mdb file, open the OpenOffice.org-base select connect to an existing database, select Microsoft Access.


browse the mdb file and you need to save a odb file that will enable you to view the tables,query etc on it.

To copy the content of a table in OpenOffice.org Calc
go to View--> Data Sources


right click in the left pannel of in the database view option, click on the "Registered databases", click "New" and locate your created odb file.


Click on the database you want to copy. Select the Queries/Tables and copy the content by righ click on the query/table name.

Paste in the OpenOffice.org-Calc. Now you can save in ods, and also save as in different formats.

Sunday, September 02, 2007