This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.cfm
95 lines (88 loc) · 3.52 KB
/
index.cfm
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
<cfapplication name="tztest">
<cfif not structkeyexists(application, "tz")>
<cfset application.tz = createObject("component","timeZone").init()>
<p>TimeZone class is now loaded</p>
</cfif>
<cfparam name="form.thisTZ" default="">
<cfscript>
t = now();
//today=createdateTime(2007,11,14,16,10,0);
today=createdateTime(year(t),month(t),day(t),hour(t),minute(t),second(t));
timeZones=application.tz.getAvailableTZ();
if (structKeyExists(form,"thisTZ")){
inDST=application.tz.isDST(today,form.thisTZ);
thisRawOffset=application.tz.getRawOffset(form.thisTZ);
thisOffset=application.tz.getTZOffset(today,form.thisTZ);
dstSavings=application.tz.getDST(form.thisTZ);
hasDST=application.tz.usesDST(form.thisTZ);
theseTZ=application.tz.getTZbyOffset(thisRawOffset);
utcDate=application.tz.castToUTC(today,form.thisTZ);
castDate=application.tz.castFromUTC(utcDate,form.thisTZ);
serverDate=application.tz.castToServer(today,form.thisTZ);
fromServer=application.tz.castFromServer(today,form.thisTZ);
serverTZ=application.tz.getServerTZ();
}
</cfscript>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>timeZone.cfc testbed</title>
<style type="text/css" media="screen">
TABLE {
font-size : 85%;
}
</style>
</head>
<body>
<form action="index.cfm" method="post">
<b>timezone</b>:
<select name="thisTZ" size="1">
<cfoutput>
<cfloop index="i" from="1" to="#arrayLen(timeZones)#">
<option value="#timeZones[i]#"<cfif form.thistz eq timeZones[i]> selected="selected"</cfif>>#timeZones[i]#</option>
</cfloop>
</cfoutput>
</select>
<input type="submit" value="go">
</form>
<cfif structKeyExists(form,"thisTZ")>
<cfoutput>
<table cellspacing="2" cellpadding="1">
<tr><td align="right"><b>server datetime</b> :: </td><td>#dateformat(today)# #timeformat(today)#</td></tr>
<tr><td align="right"><b>server timezone</b> :: </td><td>#serverTZ#</td></tr>
<tr><td align="right"><b>selected timezone</b> :: </td><td>#form.thisTZ#</td></tr>
<tr><td align="right"><b>raw offset</b> :: </td><td>#numberFormat(thisRawOffset,"+__.__")# hrs</td></tr>
<tr><td align="right"><b>offset</b> :: </td><td>#numberFormat(thisOffset,"+__.__")# hrs</td></tr>
<tr><td align="right"><b>DST savings</b> :: </td><td>#numberFormat(dstSavings,"+__.__")# hrs</td></tr>
<tr><td align="right"><b>uses DST</b> :: </td><td>#hasDST#</td></tr>
<tr><td align="right"><b>in DST</b> :: </td><td>#inDST#</td></tr>
<tr><td align="right"><b>cast to UTC</b> :: </td><td>#dateFormat(UTCdate)# #timeFormat(UTCdate)#</td></tr>
<tr><td align="right"><b>cast from UTC</b> :: </td><td>#dateFormat(castDate)# #timeFormat(castDate)#</td></tr>
<tr><td align="right"><b>cast to server</b> :: </td><td>#dateFormat(serverDate)# #timeFormat(serverDate)#</td></tr>
<tr><td align="right"><b>cast from server</b> :: </td><td>#dateFormat(fromServer)# #timeFormat(fromServer)#</td></tr>
</table>
</cfoutput>
<br>
<table cellspacing="1" cellpadding="1">
<tr><td colspan="10" height="20px"></td></tr>
<tr valign="top" bgcolor="#c0c0c0">
<td colspan="10"><b>Other timezones with <cfoutput>#numberFormat(thisRawOffset,"+__.__")#</cfoutput> hrs raw offset.</b></td>
</tr>
<cfif arrayLen(theseTZ)>
<cfoutput>
<cfloop index="i" from="1" to="#arrayLen(theseTZ)#">
<tr>
<td>#theseTZ[i]#</td>
</tr>
</cfloop>
</cfoutput>
<cfelse>
<tr><td><b>None found.</b></td></tr>
</cfif>
</table>
</cfif>
</body>
</html>