Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Determine if a date is during DST
Is there an easy way in coldfusion to determine if a give date/time
happened/will happen during Daylight Saving Time? I can find out if the server
is currently observing DST. But I need to know this for a time stamp that was
recorded without time zone info. I know that the time zone this was recorded
for does observer DST, but I don't want to have to write a function to parse
out if the day falls between April and October.
Any help? Or am I going to have to do this the hard way?
Guest
-
JSObject returns wrong date. How can Iextract correct date from digital signature?
I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and... -
#39245 [NEW]: date function generate wrong date with 1162083600 timestamp
From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ... -
determine the clients date & time
When someone submits a form I want to determine the _clients_ date and time. So I can't use now() since that gives me the date and time of the... -
Using ASP to determine the OS
I want to determine the operating system using ASP (or VBScript inside of ASP). I tried to get it using the Request.... -
Convert date/time to date in SQL Server 2000 statement
Can this be done? tia -
PaulH #2
Re: Determine if a date is during DST
[url]http://www.sustainablegis.com/projects/tz/testTZCFC.cfm[/url] should do the trick.
PaulH Guest
-
Re: Determine if a date is during DST
Ok, that is along the same line as what I am needing, but not quite. What I
need is to determine if a date happend during daylight saving time. But that
information is not stored in the data. Basicly what I need is an algorithm for
calculating if a date falls between the begining and ending of DST. I tried
using dateConvert(local2utc, date) as I know that the dates were recorded with
DST taken into account. But that is giving the same UTC offset for every day
of the year. (the server is in DST right now).
Guest
-
Another Phil #4
Re: Determine if a date is during DST
Look in the Java API for Timezones at java.sun.com. There is a method that
allows you to check and see if a date / time falls in daylight savings.
An example of how to use that in Cold Fusion is the following:
<cfobject type="java" class="java.util.TimeZone" name="TZ" action="create">
<cfset tzdate = tzdatechk.init(#DateFormat(thedate, 'yyyy')#,
#DateFormat(thedate, 'mm')#, #DateFormat(thedate, 'dd')#)>
<cfif #ret.inDaylightTime(tzdate)# EQ true>
**do stuff**
</cfif>
Hope this helps.
Phil
Another Phil Guest
-
Re: Determine if a date is during DST
Very cool, Phil, thanks!
I'm not that familiar with using java objects in coldfusion code. But, I can
see how they would be very powerful. (Personaly I'd rather by writting code in
java than cfml anyway)
Guest
-
PaulH #6
Re: Determine if a date is during DST
if you looked at that CFC you should have seen a method isDST() to handle that.
you pass it a valid cf datetime & a timezone ID & it would return whether or
not that datetime is in DST or not. not all tz have DST (there are islands of
non-DST tz in the US for example), not all tz start/end DST aty the same time.
PaulH Guest



Reply With Quote

