6502,cloudgen,jQuery Plugin book,Freelance Web Designer HK
Daily Examplet

Javascript Examplets and Examples

Select the following Topics you are interested

  1. List of all Javascript Examplets and Examples

Javascript Examplet - to write a date in spanish

This "Javascript examplet" is extracted from article "How to write a spanish Date function?" from Cloudgen's Javascript Laboratory

 


Statement of Goal

to write a date in spanish

 


Snippet:

The following is the source code of the snippet. Click the link for downloading the snippet.

<script type="text/javascript">
function spanishDate(d){
	var weekday=["Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"];
	var monthname=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
	return weekday[d.getDay()]+" "+d.getDate()+" de "+monthname[d.getMonth()]+" de "+d.getFullYear()
}
</script>

Application Note:

The following is the application code of the snippet.

<script type="text/javascript">
var d = new Date()
document.write(spanishDate(d));
</script>

Output:


Copyright 2012 Cloudgen