Autochange a date on a web page

Posted by Webquestionss under ASP.NET on 10/16/2012 | Points: 10 | Views : 875 | Status : [Member] | Replies : 0
Daily I have to manually change the date on a index.aspx page,then upload it on FTP,what would be the C# code which changes the date automatically on a daily basis,I tried this script:
<script language="JavaScript">
<!--
var days=new Array(8);
days[1] = "Sun";
days[2] = "Mon";
days[3] = "Tue";
days[4] = "Wed";
days[5] = "Thu";
days[6] = "Fri";
days[7] = "Sat";
var months=new Array(13);
months[1] = "Jan";
months[2] = "Feb";
months[3] = "Mar";
months[4] = "Apr";
months[5] = "May";
months[6] = "Jun";
months[7] = "Jul";
months[8] = "Aug";
months[9] = "Sep";
months[10] = "Oct";
months[11] = "Nov";
months[12] = "Dec";
var dateObj=new Date()
var wday=days[dateObj.getDay() + 1]
var lmonth=months[dateObj.getMonth() + 1]
var date=dateObj.getDate()
var year=dateObj.getYear()
if (year >= 100 && year <= 1999)
{year=year + 1900}
else
{year=year}
document.write(date+ " " + lmonth + " " + year)
</script>
As its a java script it takes information from the client's system, What would be the correct way to include DateTime in C# so retrieve the date on a daily basis.




Responses

(No response found.)

Login to post response