Page 1 of 1

current date - simple text

Posted: Mon Jul 02, 2018 2:12 am
by longman
Hi guys,

How can i have the current day date in text format that updates automatically every day? in this format, example "Monday, July 2, 2018"

Thanks!

Re: current date - simple text

Posted: Mon Jul 02, 2018 2:25 am
by BaconFries
Have you looked in Ready-to-use-Javascript? 'Basic Date'

Re: current date - simple text

Posted: Mon Jul 02, 2018 2:51 am
by longman
I was gonna avoid using Java script, so that's the only way, right?

My aim was using less and less java scripts on my pages.

Re: current date - simple text

Posted: Mon Jul 02, 2018 3:02 am
by BaconFries
You will either need to use some form of scripting such as javascript or php.

Re: current date - simple text

Posted: Wed Jul 04, 2018 5:36 am
by MGD4me
Make sure your page type is php, eg: index.php

Select Insert HTML , and place the the code block wherever you wish to have the date displayed.

Insert this code: (Change the font size and color as you wish)

<SPAN STYLE="color: gold; font-size: 16pt">
<script language="JavaScript" type="text/javascript">
<!--
var
month = new Array();
month[0]="Jan";
month[1]="Feb";
month[2]="Mar";
month[3]="Apr";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="Aug";
month[8]="Sept";
month[9]="Oct";
month[10]="Nov";
month[11]="Dec";
var
day = new Array();
day[0]="Sunday";
day[1]="Monday";
day[2]="Tuesday";
day[3]="Wednesday";
day[4]="Thursday";
day[5]="Friday";
day[6]="Saturday";
today = new Date();
date = today.getDate();
day = (day[today.getDay()]);
month = (month[today.getMonth()]);
year = (today.getFullYear());
suffix = (date==1 || date==21 || date==31) ? "st" : "th" &&
(date==2 || date==22) ? "nd" : "th" && (date==3 || date==23) ? "rd" : "th"
function print_date()
{
document.write(day + "," + "&nbsp;" + "&nbsp;" + month + "&nbsp" + date + "<sup>" + suffix + "</sup>" + "&nbsp;" + "&nbsp;" + year);
}
// -->
</script>
<script>
<!--
print_date();
//-->
</script>
</span><br />