Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Funcion para obtener la fecha actual

// esta funcion te regresa la fecha actual, tiene una condicional contemplando la cuestion del bug Y2K, usala de la siguiente manera:
La fecha de hoy es <script language="JavaScript" type="text/javascript">document.write(month + ", " + date + ", " + year)</script>

<script language="JavaScript">
<!--
var months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";


var today = new Date()
var month = months[today.getMonth() + 1]
var date = today.getDate()
var year = today.getYear()
if (year >= 100 && year <= 1999)
{year=year + 1900}
else
{year=year}

//-->
</script>

You need to create an account or log in to post comments to this site.