Apt articles on health, wealth, happiness

Free year, month, day JavaScript, page 5 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 yesterday's date in the form of year, month, day, in a string.

Author: AptArticle.com

Description: It's Java Script that displays yesterday's date in the form of year, month, day, in a string.

Assumption: Here we're assuming you want yesterday's date in the form of December 31, 2020.

Demo: The following demo shows what this script can do for you. Notice that, with minor exceptions, the displayed date is not today's date, but yesterday's date.








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.

<div class="txt6">
<script>

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

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

var mydate=new Date();
var year=mydate.getYear();
year=year+1900;
var day=mydate.getDay();
var month=mydate.getMonth();
var daym=mydate.getDate();
var montharray=new Array("January","February","March","April","May",
"June","July","August","September","October","November","December");
daym=daym-1;
if (daym<1){daym=daym+1;}
document.write(montharray[month]+" "+daym+", "+year);
</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!