Professional Web Applications Themes

Timezone / now() function - Coldfusion - Advanced Techniques

I looked for an answer to this problem for days !!! We have a shared hosting server that is in Australia that contains applications used by Australian users, however some of the applications are specific to Hong Knog (accessed by Hong Kong users from Hong Knog) The problem is that the application uses now() function which gets the date/time in Australia (where the server is) . How can we make this one application use the Hong Kong timezone but keep all other applications on the same server use Australian Timezone ? We basically eed to control the value of Now() ...

  1. #1

    Default Timezone / now() function

    I looked for an answer to this problem for days !!!

    We have a shared hosting server that is in Australia that contains
    applications used by Australian users, however some of the applications are
    specific to Hong Knog (accessed by Hong Kong users from Hong Knog) The problem
    is that the application uses now() function which gets the date/time in
    Australia (where the server is) . How can we make this one application use the
    Hong Kong timezone but keep all other applications on the same server use
    Australian Timezone ?

    We basically eed to control the value of Now() at application level and not at
    server level. Is this possible ?

    Thanks

    Zach_Stone Guest

  2. #2

    Default Re: Timezone / now() function

    switch from now() to a var that contains the hong kong tz datetime which you can cast from the server's tz. maybe [url]http://www.sustainablegis.com/projects/tz/testTZCFC.cfm[/url] might help.

    PaulH Guest

  3. #3

    Default Re: Timezone / now() function

    Thanks for your reply Paul,

    If I do this will I still be able to use the now() variable ?

    We've got thousands of lines of code that are using now() so would be great if
    we can keep the var now() the same and just change its value to the new
    timezone !

    Zach_Stone Guest

  4. #4

    Default Re: Timezone / now() function

    sorry no. the now() function returns the datetime from the cf server. you'll
    need to set the hong kong now say in the application.cfm (or application.cfc)
    and use that in place of the now() function. it should be simple enough to do
    a search and replace.

    it would probably be a good idea to review all your apps for this kind of
    problem going forward. for example, how are you handling australia's 3 tz? we
    normally use UTC (GMT) for all datetimes and cast to the user's tz as required
    (that's where the timeZone.cfc came from in the first place).

    PaulH Guest

Similar Threads

  1. support for timezone / DST
    By in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 4th, 07:54 PM
  2. ANNOUNCE: DateTime::TimeZone 0.44
    By Dave Rolsky in forum PERL Modules
    Replies: 0
    Last Post: April 17th, 07:40 PM
  3. ANNOUNCE: DateTime::TimeZone 0.43
    By Dave Rolsky in forum PERL Modules
    Replies: 0
    Last Post: April 13th, 09:22 PM
  4. timezone in javascript
    By Christopher Brandsdal in forum ASP
    Replies: 2
    Last Post: August 20th, 03:16 PM
  5. Timezone with MSSQL/IIS/ASP
    By Bjørn H. Hanto in forum ASP Database
    Replies: 0
    Last Post: July 6th, 11:20 AM

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