var Welcome = " ";
var DateToday = " ";
//
//Get date
var tDate = new Date();
function DateApp() {
//Find day (DayText) of the week
var tDay = tDate.getDay();
if (tDay == 0)
{
DayText = "Sunday"
}
else if (tDay == 1)
{
DayText = "Monday"
}
else if (tDay == 2)
{
DayText = "Tuesday"
}
else if (tDay == 3)
{
DayText = "Wednesday"
}
else if (tDay == 4)
{
DayText = "Thursday"
}
else if (tDay == 5)
{
DayText = "Friday"
}
else
{
DayText = "Saturday"
}
//Find date (tDayMonth) of the month
var DayMonth = tDate.getDate();
//Find month (tMonth) of the year
var tMonth = tDate.getMonth();
if (tMonth == 0)
{
MonthText = "January"
}
else if (tMonth == 1)
{
MonthText = "February"
}
else if (tMonth == 2)
{
MonthText = "March"
}
else if (tMonth == 3)
{
MonthText = "April"
}
else if (tMonth == 4)
{
MonthText = "May"
}
else if (tMonth == 5)
{
MonthText = "June"
}
else if (tMonth == 6)
{
MonthText = "July"
}
else if (tMonth == 7)
{
MonthText = "August"
}
else if (tMonth == 8)
{
MonthText = "September"
}
else if (tMonth == 9)
{
MonthText = "October"
}
else if (tMonth == 10)
{
MonthText = "November"
}
else
{
MonthText = "December"
}
//Find year (tYear)
var tYear = tDate.getYear();
//Concat the above
DateToday = DayText + ", " + MonthText + " " + DayMonth + " " + tYear;
//------------------------------------------------------------------------------------------------------
//Find hours of day
var tHours = tDate.getHours();
//Decide welcome
// var Welcome = ""
if (tHours <= 12)
{
Welcome = "morning"
}
else if (tHours <= 18)
{
Welcome = "afternoon"
}
else
{
Welcome = "evening"
}
/* document.write(tDate +"
");
document.write("Day No: " + tDay +"
");
document.write("Day Text: " + DayText +"
");
document.write("Date: " + DayMonth +"
");
document.write("Month Number: " + tMonth +"
");
document.write("Month Text: " + MonthText +"
");
document.write("Year: " + tYear +"
");
document.write("Today's Date: " + DateToday +"
");
document.write("Hours: " + tHours +"
");
document.write(Welcome +"
");
*/
}
DateApp();