Do nhu cầu khách hàng cần code hiện thị ngày tháng năm và có lời chúc tương ứng , mình có sưu tầm dùng ok rồi , nay share lại cho anh em nào cần dùng nhé

Code java hiện thị ngày tháng năm và lời chúc tương ứng
Vào việc ngay nhé , Dán code dưới vào HTML cần hiện thị là được
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
<div class=“lich”>
<iclass=“fa fm fa-calendar”></i>Hômnay
<script language=“JavaScript”>
<!—
// Store the date In avarlable
d=newDate()
dateText=“”
// Get the cuurent day and convert it to the name of the day
dayValue=d.getDay()
if(dayValue==0)
dateText+=“Chủ Nhật”
elseif(dayValue==1)
dateText+=“Thứ hai”
elseif(dayValue==2)
dateText+=“Thứ Ba”
elseif(dayValue==3)
dateText+=“Thứ Tư”
elseif(dayValue==4)
dateText+=“Thứ Năm”
elseif(dayValue==5)
dateText+=“Thứ Sáu”
elseif(dayValue==6)
dateText+=“Thứ Bảy”
// Get the current date; if it’s before 2000,add 1900
dateText+=“, Ngày “+d.getDate()
monthValue=d.getMonth()
dateText+=” “
if(monthValue==0)
dateText+=“Tháng 1”
if(monthValue==1)
dateText+=“Tháng 2”
if(monthValue==2)
dateText+=“Tháng 3”
if(monthValue==3)
dateText+=“Tháng 4”
if(monthValue==4)
dateText+=“Tháng 5”
if(monthValue==5)
dateText+=“Tháng 6”
if(monthValue==6)
dateText+=“Tháng 7”
if(monthValue==7)
dateText+=“Tháng 8”
if(monthValue==8)
dateText+=“Tháng 9”
if(monthValue==9)
dateText+=“Tháng 10”
if(monthValue==10)
dateText+=“Tháng 11”
if(monthValue==11)
dateText+=“Tháng 12”
// Get the current year; if it’s before 2000, add 1900
if(d.getYear()<2000)
dateText+=“, Năm “+(1900+d.getYear())
else
dateText+=“, Năm “+(d.getYear())
// Get the current minutes
minuteValue=d.getMinutes()
if(minuteValue<10)
minuteValue=“0”+minuteValue
// Get the current hours
hourValue=d.getHours()
// Customize the greeting based on the current hours
if(hourValue>=5&&hourValue<=10)
{
timeText= ” Chào buổi sáng và chúc một ngày tốt lành!”
}
elseif(hourValue>10&&hourValue<=12)
{
timeText= ” Chào buổi trưa – Bạn ăn cơm chưa vậy?”
}
elseif(hourValue>=13&&hourValue<17)
{
timeText=” Chào buổi chiều! “
}
elseif(hourValue>=17&&hourValue<18)
{
timeText=” Chào buổi chiều bạn nhé!”
}
elseif(hourValue>=18&&hourValue<21)
{
timeText= ” Chào buổi tối!”
}
elseif(hourValue>=21&&hourValue<=24)
{
timeText= ” Chúc bạn ngủ ngon và có giấc mơ đẹp!”
}
elseif(hourValue>=1&&hourValue<5)
{
timeText=“Chúc bạn một ngày vui vẻ!”
}
document.write( dateText+“”+timeText+“”)
—>
</script>
</div>
|
Chú ý : để hiện thị Icon ngày trước cần cài Font Awesome 5 bản miễn phí nhé
Sau khi cài đặt Code java hiện thị ngày tháng năm sẽ được như thế này :

Chúc các bạn thành công nhé