Hi 

Thanks to everyone for all your help, I decided to give java 1_4_2_17 ago as
it includes the latest DST, where as the 1_4_2_11 does not, this seems to
have fixed the problem.

Re the question of running daylight savings time on the server being on or
off - according to the Adobe KB it has no effect, although this does not
seem to be the case on any test I have done.

If the Server DST is off on the server then any date selected in a DST
period is out by one hour,
Now with the later version of the JVM and the Server DST on all seems to
work correctly.

Maybe I have something wrong, but for now all is working as it should. 

Thanks.

Stephen Davey

-----Original Message-----
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of ACTCFUG
Sent: Saturday, 7 June 2008 3:15 AM
To: cfaussie
Subject: [cfaussie] Re: Coldfusion & Daylight saving


I know that a regular here - Michael Kear - has a nifty solution which
I have also utilised to great effect (www.actcfug.com) - and quite
easily. This was something MK himself had issues with and managed to
solve bless him.

Our server is not based in Australia so date/time can be a finicky
thing. Pain in the butt even. MK's simple solution has worked very
well (Australia changing the rules not-withstanding) for several years
now. Remember the recent DLS issue was not of Microsoft's making but
the Oz government deciding to extend DLS a bit. Anyway read on...

Essentially:

<cfscript>
function DateConvertZ(conversionType, dateObj, zoneInfo)
{
  var targetZone = "";
  var targetSpan = 0;
  var targetDate = "";
  var utcDate = "";
  var hourDiff = 0;
  var minDiff = 0;
  var zoneModOffSet = 0;
  var zoneMod = 0;

  //timeZone object
  var timeZone = StructNew();
  timeZone.UTC  =   0;     // Universal Time Coordinate or universal
time zone
  timeZone.GMT  =   0;     // Greenwich Mean Time same as UTC
  timeZone.BST  =   1;     // British Summer time
  timeZone.IST  =   1;     // Irish Summer Time
  timeZone.WET  =   1;     // Western Europe Time
  timeZone.WEST =   1;     // Western Europe Summer Time
  timeZone.CET  =   1;     // Central Europe Time
  timeZone.CEST =   2;     // Central Europe Summer Time
  timeZone.EET  =   2;     // Eastern Europe Time
  timeZone.EEST =   3;     // Eastern Europe Summer Time
  timeZone.MSK  =   3;     // Moscow time
  timeZone.MSD  =   4;     // Moscow Summer Time
  timeZone.AST  =  -4;     // Atlantic Standard Time
  timeZone.ADT  =  -3;     // Atlantic Daylight Time
  timeZone.EST  =  -5;     // Eastern Standard Time
  timeZone.EDT  =  -4;     // Eastern Daylight Saving Time
  timeZone.CST  =  -6;     // Eastern Time
  timeZone.CDT  =  -5;     // Central Standard Time
  timeZone.MST  =  -7;     // Mountain Standard Time
  timeZone.MDT  =  -6;     // Mountain Daylight Saving Time
  timeZone.PST  =  -8;     // Pacific Standard Time
  timeZone.HST  = -10;     // Hawaiian Standard Time
  timeZone.AKST =  -9;     // Alaska Standard Time
  timeZone.AKDT =  -8;     // Alaska Standard Daylight Saving Time
  timeZone.AEST =  10;     // Australian Eastern Standard Time
  timeZone.AEDT =  11;     // Australian Eastern Daylight Time
  timeZone.ACST = 9.5;     // Australian Central Standard Time
  timeZone.ACDT = 10.5;    // Australian Central Daylight Time
  timeZone.AWST =   8;     // Australian Western Standard Time

  //Check for +- timezone mod such as PST-4
  zoneModOffSet = FindOneOf("+-", zoneInfo);
  if(zoneModOffSet) {
    //Extract out the zoneInfo and zoneMod
    zoneMod = Val(Right(zoneInfo, Len(zoneInfo) - zoneModOffSet + 1));
    zoneInfo = Left(zoneInfo, zonemodOffSet - 1);
  }

  targetZone = timeZone[zoneInfo] + zoneMod;

  // Grab Target Zone Info
  hourDiff = fix(targetZone);
  minDiff = (targetZone - hourDiff) * 60;

  targetSpan = CreateTimeSpan(0, hourDiff, minDiff, 0);

  if (conversionType IS "local2zone") {
    // date is local time so convert it to utc first
    utcDate = DateConvert("Local2Utc", dateObj) ;
    // Add the target zone difference
    targetDate = utcDate + targetSpan;
    return "{ts '" & DateFormat(targetDate, "yyyy-mm-dd ") &
TimeFormat(targetDate, "HH:mm:ss") & "'}";
  }
  else if (conversionType is "zone2local") {
    //date is in the target zone so convert it to utc first
    targetDate = dateObj - targetSpan;
    //convert it back from utc to local
    targetDate = DateConvert("Utc2local", targetDate);
    return "{ts '" & DateFormat(targetDate, "yyyy-mm-dd ") &
TimeFormat(targetDate, "HH:mm:ss") & "'}";
  }
  return "{ts 'yyyy-mm-dd HH:mm:ss'}"; // error return
}
function FormatTeaser(string,number){
        var urlArgument = "";
        var shortString = "";

        //return quickly if string is short or no spaces at all
        if(len(string) lte number or not refind("[[:space:]]",string))
return
string;

        if(arrayLen(arguments) gt 2) urlArgument = "... <font
color=008001>[</
font> <a href=""" & arguments[3] & """>More</a> <font
color=008001<strong>]</strong></font>...";

        //Full Left code (http://www.cflib.org/udf.cfm?ID=329)
        if(reFind("[[:space:]]",mid(string,number+1,1))) {
                shortString = left(string,number);
        } else {
                if(number-refind("[[:space:]]",
reverse(mid(string,1,number))))
shortString = Left(string, (number-refind("[[:space:]]",
reverse(mid(string,1,number)))));
                else shortString = left(str,1);
        }

        return shortString & urlArgument;

}
</cfscript>

And I reference it like thus (say before a database insert or update):

<cfset todayPST = Now()>
<cfset Form.ArticleDate = DateConvertZ("local2zone", todayPST,
"AEDT")>

And the FORM variable is what goes to the db. I'm not saying MK wrote
it but he found it and it works great.

I also like this script for masking a EMAIL ADDRESS from spam bots (I
wrote this and have tested it for over three years):

<cfscript>
function EmailAntiSpam(EmailAddress) {
        var i = 1;
        var antiSpam = "";
        for (i=1; i LTE len(EmailAddress); i=i+1) {
                antiSpam = antiSpam & "&##" & asc(mid(EmailAddress,i,1)) &
";";
        }
        if ((ArrayLen(Arguments) eq 2) AND (Arguments[2] is "Yes")) return
"<a href=" & "mailto:"; & antiSpam & ">" & antiSpam & "</a>";
        else return antiSpam;
}
</cfscript>

It is used thus (supplant REQUEST.ADMINEMAIL for your chosen email
address):

<a href="mailto:#EmailAntispam(Request.AdminEmail)#?subject=Your own
subject">#EmailAntispam(Request.AdminEmail)#</a>

Browser or bot receives something like this:

<a
href="mailto:&#112;&#114;&#101;&#115;&#105;&#100;&#101;&#110;&#116;&#64;&#97
;&#99;&#116;&#99;&#102;&#117;&#103;&#46;&#99;&#111;&#109;?
subject=ACTCFUG">&#112;&#114;&#101;&#115;&#105;&#100;&#101;&#110;&#116;&#64;
&#97;&#99;&#116;&#99;&#102;&#117;&#103;&#46;&#99;&#111;&#109;</
a>

A bit of a difference eh?

Kind regards,

PT

No virus found in this incoming message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 270.0.0/1484 - Release Date: 4/06/2008
4:40 PM


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to