Skip to content

Commit 2fe34ba

Browse files
committed
Add styles and bold printed output
1 parent 22ec8d1 commit 2fe34ba

File tree

3 files changed

+163
-34
lines changed

3 files changed

+163
-34
lines changed

datetime-coldfusion/datetime.cfm

Lines changed: 151 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!DOCTYPE html>
22
<head>
3+
<link rel = "stylesheet" type = "text/css" href = "datetime.css">
34
<title>
45
Get date and time in ColdFusion
56
</title>
@@ -43,91 +44,208 @@ Enter date and time values
4344
<cfset enteredDate = CreateDateTime(form.year, form.month, form.day, form.hour, form.minute, form.second, form.millisecond)>
4445
<!---set entered date to form input values--->
4546
<!---output the date and time in all supported formats--->
46-
<cfoutput>Day of Month: #dateTimeFormat(enteredDate, "d")#</cfoutput>
47+
<cfoutput>
48+
Day of Month:
49+
<span id = "output">#dateTimeFormat(enteredDate, "d")#
50+
</span>
51+
</cfoutput>
4752
<br/>
48-
<cfoutput>Day of Week: #dateTimeFormat(enteredDate, "EEE")# (#dateTimeFormat(enteredDate, "EEEE")#)</cfoutput>
53+
<cfoutput>
54+
Day of Week:
55+
<span id = "output">#dateTimeFormat(enteredDate, "EEE")# (#dateTimeFormat(enteredDate, "EEEE")#
56+
)
57+
</span>
58+
</cfoutput>
4959
<br/>
5060
<cfoutput>
51-
Month: #dateTimeFormat(enteredDate, "m")# (#dateTimeFormat(enteredDate, "mmm")#) (#dateTimeFormat(enteredDate, "mmmm")#
52-
) (#dateTimeFormat(enteredDate, "M")#)
61+
Month:
62+
<span id = "output">#dateTimeFormat(enteredDate, "m")# (#dateTimeFormat(enteredDate, "mmm")#
63+
) (#dateTimeFormat(enteredDate, "mmmm")#) (#dateTimeFormat(enteredDate, "M")#)
64+
</span>
5365
</cfoutput>
5466
<br/>
55-
<cfoutput>Day of Year: #dateTimeFormat(enteredDate, "D")#</cfoutput>
67+
<cfoutput>
68+
Day of Year:
69+
<span id = "output">#dateTimeFormat(enteredDate, "D")#
70+
</span>
71+
</cfoutput>
5672
<br/>
57-
<cfoutput>Year: #dateTimeFormat(enteredDate, "yyyy")# (#dateTimeFormat(enteredDate, "yy")#)</cfoutput>
73+
<cfoutput>
74+
Year:
75+
<span id = "output">#dateTimeFormat(enteredDate, "yyyy")# (#dateTimeFormat(enteredDate, "yy")#
76+
)
77+
</span>
78+
</cfoutput>
5879
<br/>
59-
<cfoutput>Week Year: #dateTimeFormat(enteredDate, "YYYY")# (#dateTimeFormat(enteredDate, "Y")#)</cfoutput>
80+
<cfoutput>
81+
Week Year:
82+
<span id = "output">#dateTimeFormat(enteredDate, "YYYY")# (#dateTimeFormat(enteredDate, "Y")#
83+
)
84+
</span>
85+
</cfoutput>
6086
<br/>
61-
<cfoutput>Period/Era: #dateTimeFormat(enteredDate, "G")#</cfoutput>
87+
<cfoutput>
88+
Period/Era:
89+
<span id = "output">#dateTimeFormat(enteredDate, "G")#
90+
</span>
91+
</cfoutput>
6292
<br/>
63-
<cfoutput>12 Hour Format: #dateTimeFormat(enteredDate, "h")#</cfoutput>
93+
<cfoutput>
94+
12 Hour Format:
95+
<span id = "output">#dateTimeFormat(enteredDate, "h")#
96+
</span>
97+
</cfoutput>
6498
<br/>
65-
<cfoutput>24 Hour Format: #dateTimeFormat(enteredDate, "H")#</cfoutput>
99+
<cfoutput>
100+
24 Hour Format:
101+
<span id = "output">#dateTimeFormat(enteredDate, "H")#
102+
</span>
103+
</cfoutput>
66104
<br/>
67-
<cfoutput>Minute: #dateTimeFormat(enteredDate, "n")#</cfoutput>
105+
<cfoutput>
106+
Minute:
107+
<span id = "output">#dateTimeFormat(enteredDate, "n")#
108+
</span>
109+
</cfoutput>
68110
<br/>
69-
<cfoutput>Second: #dateTimeFormat(enteredDate, "s")#</cfoutput>
111+
<cfoutput>
112+
Second:
113+
<span id = "output">#dateTimeFormat(enteredDate, "s")#
114+
</span>
115+
</cfoutput>
70116
<br/>
71-
<cfoutput>Milliseconds: #dateTimeFormat(enteredDate, "l")# (#dateTimeFormat(enteredDate, "L")#)</cfoutput>
117+
<cfoutput>
118+
Milliseconds:
119+
<span id = "output">#dateTimeFormat(enteredDate, "l")# (#dateTimeFormat(enteredDate, "L")#)
120+
</span>
121+
</cfoutput>
72122
<br/>
73-
<cfoutput>Time Marker String: #dateTimeFormat(enteredDate, "t")# (#dateTimeFormat(enteredDate, "tt")#)</cfoutput>
123+
<cfoutput>
124+
Time Marker String:
125+
<span id = "output">#dateTimeFormat(enteredDate, "t")# (#dateTimeFormat(enteredDate, "tt")#)
126+
</span>
127+
</cfoutput>
74128
<br/>
75-
<cfoutput>Week of Year: #dateTimeFormat(enteredDate, "w")#</cfoutput>
129+
<cfoutput>
130+
Week of Year:
131+
<span id = "output">#dateTimeFormat(enteredDate, "w")#
132+
</span>
133+
</cfoutput>
76134
<br/>
77-
<cfoutput>Week of Month: #dateTimeFormat(enteredDate, "W")#</cfoutput>
135+
<cfoutput>
136+
Week of Month:
137+
<span id = "output">#dateTimeFormat(enteredDate, "W")#
138+
</span>
139+
</cfoutput>
78140
<br/>
79-
<cfoutput>ISO Format: #dateTimeFormat(enteredDate, "iso")#</cfoutput>
141+
<cfoutput>
142+
ISO Format:
143+
<span id = "output">#dateTimeFormat(enteredDate, "iso")#
144+
</span>
145+
</cfoutput>
80146
<br/>
81147
<cfelse><!---if form is not submitted any input data--->
82148
<!---output the current date and time in all supported formats--->
83-
<cfoutput>Current Day of Month: #dateTimeFormat(dateAndTimeNow, "d")#</cfoutput>
149+
<cfoutput>
150+
Current Day of Month:
151+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "d")#
152+
</span>
153+
</cfoutput>
84154
<br/>
85155
<cfoutput>
86-
Current Day of Week: #dateTimeFormat(dateAndTimeNow, "EEE")# (#dateTimeFormat(dateAndTimeNow, "EEEE")#
156+
Current Day of Week:
157+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "EEE")# (#dateTimeFormat(dateAndTimeNow, "EEEE")#
87158
)
159+
</span>
88160
</cfoutput>
89161
<br/>
90162
<cfoutput>
91-
Current Month: #dateTimeFormat(dateAndTimeNow, "m")# (#dateTimeFormat(dateAndTimeNow, "mmm")#
163+
Current Month:
164+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "m")# (#dateTimeFormat(dateAndTimeNow, "mmm")#
92165
) (#dateTimeFormat(dateAndTimeNow, "mmmm")#) (#dateTimeFormat(dateAndTimeNow, "M")#)
166+
</span>
93167
</cfoutput>
94168
<br/>
95-
<cfoutput>Current Day of Year: #dateTimeFormat(dateAndTimeNow, "D")#</cfoutput>
169+
<cfoutput>
170+
Current Day of Year:
171+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "D")#
172+
</span>
173+
</cfoutput>
96174
<br/>
97175
<cfoutput>
98-
Current Year: #dateTimeFormat(dateAndTimeNow, "yyyy")# (#dateTimeFormat(dateAndTimeNow, "yy")#
176+
Current Year:
177+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "yyyy")# (#dateTimeFormat(dateAndTimeNow, "yy")#
99178
)
179+
</span>
100180
</cfoutput>
101181
<br/>
102182
<cfoutput>
103-
Current Week Year: #dateTimeFormat(dateAndTimeNow, "YYYY")# (#dateTimeFormat(dateAndTimeNow, "Y")#
183+
Current Week Year:
184+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "YYYY")# (#dateTimeFormat(dateAndTimeNow, "Y")#
104185
)
186+
</span>
105187
</cfoutput>
106188
<br/>
107-
<cfoutput>Current Period/Era: #dateTimeFormat(dateAndTimeNow, "G")#</cfoutput>
189+
<cfoutput>
190+
Current Period/Era:
191+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "G")#
192+
</span>
193+
</cfoutput>
108194
<br/>
109-
<cfoutput>Current 12 Hour Format: #dateTimeFormat(dateAndTimeNow, "h")#</cfoutput>
195+
<cfoutput>
196+
Current 12 Hour Format:
197+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "h")#
198+
</span>
199+
</cfoutput>
110200
<br/>
111-
<cfoutput>Current 24 Hour Format: #dateTimeFormat(dateAndTimeNow, "H")#</cfoutput>
201+
<cfoutput>
202+
Current 24 Hour Format:
203+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "H")#
204+
</span>
205+
</cfoutput>
112206
<br/>
113-
<cfoutput>Current Minute: #dateTimeFormat(dateAndTimeNow, "n")#</cfoutput>
207+
<cfoutput>
208+
Current Minute:
209+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "n")#
210+
</span>
211+
</cfoutput>
114212
<br/>
115-
<cfoutput>Current Second: #dateTimeFormat(dateAndTimeNow, "s")#</cfoutput>
213+
<cfoutput>
214+
Current Second:
215+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "s")#
216+
</span>
217+
</cfoutput>
116218
<br/>
117219
<cfoutput>
118-
Current Milliseconds: #dateTimeFormat(dateAndTimeNow, "l")# (#dateTimeFormat(dateAndTimeNow, "L")#
220+
Current Milliseconds:
221+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "l")# (#dateTimeFormat(dateAndTimeNow, "L")#
119222
)
223+
</span>
120224
</cfoutput>
121225
<br/>
122226
<cfoutput>
123-
Current Time Marker String: #dateTimeFormat(dateAndTimeNow, "t")# (#dateTimeFormat(dateAndTimeNow, "tt")#
227+
Current Time Marker String:
228+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "t")# (#dateTimeFormat(dateAndTimeNow, "tt")#
124229
)
230+
</span>
125231
</cfoutput>
126232
<br/>
127-
<cfoutput>Current Week of Year: #dateTimeFormat(dateAndTimeNow, "w")#</cfoutput>
233+
<cfoutput>
234+
Current Week of Year:
235+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "w")#
236+
</span>
237+
</cfoutput>
128238
<br/>
129-
<cfoutput>Current Week of Month: #dateTimeFormat(dateAndTimeNow, "W")#</cfoutput>
239+
<cfoutput>
240+
Current Week of Month:
241+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "W")#
242+
</span>
243+
</cfoutput>
130244
<br/>
131-
<cfoutput>Current ISO Format: #dateTimeFormat(dateAndTimeNow, "iso")#</cfoutput>
245+
<cfoutput>
246+
Current ISO Format:
247+
<span id = "output">#dateTimeFormat(dateAndTimeNow, "iso")#
248+
</span>
249+
</cfoutput>
132250
<br/>
133251
</cfif>

datetime-coldfusion/datetime.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* {
2+
font-family: system-ui;
3+
}
4+
5+
body {
6+
line-height: 120%;
7+
}
8+
9+
.output {
10+
font-weight: bold; /*bold text for printed output*/
11+
}

datetime-jsp/datetime.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ body {
77
}
88

99
.output {
10-
font-weight: bold; /*bold text*/
10+
font-weight: bold; /*bold text for printed output*/
1111
}

0 commit comments

Comments
 (0)