Apt articles on health, wealth, happiness

Free year, month, day JavaScript, page 1 of 7

Link to this article!



If you know what you want, then on this page you will find a script you can use now, right now. So, what do you need? This script can do wonders for your web site. Look no further, if you want a free script that displays the year, month, and day in a string.

Author: AptArticle.com

Description: This is a JavaScript that displays the year, month, and day in a string.

Assumption: Here we're assuming you want to display today's date in the form of 12/31/2020.

Demo: The following demo shows what this script can do for you:








Directions:

Step 1: Copy the following code, and add it to the 'CSS' file of your web site.

.txt6 {
font-family: Verdana, Arial;    /* may edit */
color: red;                    /* may edit */
font-weight: normal;          /* may edit */
font-size: 20pt;             /* may edit */
letter-spacing: 10px;       /* may edit */
padding: 0;                /* may edit */
}



Step 2: Copy the following code, and add it to the 'body' section of your web page.

/******* DO NOT EDIT BELOW THIS LINE ************/

<div class="txt6">
<script>
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var montharray=new Array("1","2","3","4","5","6","7","8","9","10","11","12")
document.write(montharray[month]+"/"+daym+"/"+year)

/*********************************************************
* Copyright © AptArticle.com (http://aptarticle.com)
* This notice MUST stay intact for legal use.
* Visit http://aptarticle.com/ for this script and hundreds more.
*********************************************************************/
</script>
</div>
 


Step 3: Carefully edit the above six lines of code, so that it produces the visual effect you need and want. However, in your own interest, do limit your editing to the lines we marked /* may edit */.


Step 4: Enjoy it, and have fun using it!


Tell a friend!