Professional Web Applications Themes

Need to get the current time (ET) adjusted for DST fromthe server's MST time - Coldfusion - Advanced Techniques

Hi I am really struggling with a date/time conversion thing. I have a website who's CONTENT needs to be displayed in Eastern Time (ET). I'd like it to always be updated whether we're in daylight-savings or not. The server box is in Arizona - DST is always off there and clocks never change. They are always UTC-7hours. I'm in boston which is UTC-4 OR UTC-5 depending on whether its Daylight Savings or not. (boston = ET) So, if i Do this: <cfset n=now()> - then - <cfoutput>#n#</cfoutput> = Arizona's current time. What i need is a function like this (I'm ...

  1. #1

    Default Need to get the current time (ET) adjusted for DST fromthe server's MST time

    Hi

    I am really struggling with a date/time conversion thing.

    I have a website who's CONTENT needs to be displayed in Eastern Time
    (ET). I'd like it to always be updated whether we're in
    daylight-savings or not.

    The server box is in Arizona - DST is always off there and clocks
    never change. They are always UTC-7hours.

    I'm in boston which is UTC-4 OR UTC-5 depending on whether its
    Daylight Savings or not. (boston = ET)

    So, if i Do this:
    <cfset n=now()> - then -
    <cfoutput>#n#</cfoutput> = Arizona's current time.

    What i need is a function like this (I'm making this up):

    <cfset n=convertToEasternTime(now())>

    I realize DateConvert gives me the UTC time but that's relative to
    Arizona. I still would need to calculate the correct offset (either 4
    or 5) somehow.

    Any ideas?:confused;

    brianthedrummer Guest

  2. #2

    Default Re: Need to get the current time (ET) adjusted for DSTfrom the server's MST time

    The server might be in Arizona, but Cold Fusion doesn't care. A couple of
    weeks ago someone complained about the dateadd function taking DST into account
    if you do it in hours. Therefore, something simple might work.


    Originally posted by: brianthedrummer
    Hi

    I am really struggling with a date/time conversion thing.

    I have a website who's CONTENT needs to be displayed in Eastern Time
    (ET). I'd like it to always be updated whether we're in
    daylight-savings or not.

    The server box is in Arizona - DST is always off there and clocks
    never change. They are always UTC-7hours.

    I'm in boston which is UTC-4 OR UTC-5 depending on whether its
    Daylight Savings or not. (boston = ET)

    So, if i Do this:
    <cfset n=now()> - then -
    <cfoutput>#n#</cfoutput> = Arizona's current time.

    What i need is a function like this (I'm making this up):

    <cfset n=convertToEasternTime(now())>

    I realize DateConvert gives me the UTC time but that's relative to
    Arizona. I still would need to calculate the correct offset (either 4
    or 5) somehow.

    Any ideas?:confused;



    Dan Guest

  3. #3

    Default Re: Need to get the current time (ET) adjusted for DSTfrom the server's MST time

    Actually, it does care. the now() object returns the time that's set on the box
    itself (e.g. the Windows time in this case).

    The problem is, unless i manually test each year to see when the DST kicks in
    and out, I can't know whether

    eeastern time = now +2hours
    or
    eastern time = now + 3hours

    (or you could convert the AZ time to GMT and then subtract either 4 or 5 hours
    depending on whether DST is in force or not but it's the same problem - I was
    hoping there was a function in CFML to extract any time zone's time based off
    of a GMT time)


    brianthedrummer Guest

  4. #4

    Default Re: Need to get the current time (ET) adjusted for DST from theserver's MST time

    brianthedrummer wrote: 

    http://www.sustainablegis.com/projects/tz/testTZCFC.cfm
    PaulH Guest

Similar Threads

  1. CFMX7.0.1 Administrator date time issue showing 13hrsbehind server time
    By bayfield in forum Coldfusion Server Administration
    Replies: 0
    Last Post: December 8th, 04:34 AM
  2. Replies: 7
    Last Post: August 16th, 01:05 AM
  3. DateTime being adjusted for time zone differences
    By James Cline in forum ASP.NET Web Services
    Replies: 0
    Last Post: September 24th, 03:57 PM
  4. Time adjusted
    By sandy in forum Windows Setup, Administration & Security
    Replies: 2
    Last Post: July 31st, 07:03 AM
  5. Replies: 1
    Last Post: July 20th, 03:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139