4 Replies Latest reply on Apr 13, 2007 1:50 PM by PHRED-SE

    TimeFormat(Now(),'h:mm tt')

    PHRED-SE Level 1
      I've been using TimeFormat(Now(), 'h:mm tt') for over 8 years. Suddenly TimeFormat is returning GMT time rather than local time. I know that it is returning GMT time rather than local time because I have some JavaScript code, which I have embedded along side the TimeFormat, that returns both local and GMT time, and the TimeFormat time matches the JavaScript GTM time.

      To my knowledge there is no setting within CF 6, or any other version of CF, that allows you to specify whether you want local or GMT time.

      It has to be something going on with my development system (Windows 2000 Server, IIS) because the same code running on our production server returns the local time rather than GMT time.

      The only thing that I can think of that has changed on my server is that I modified the system with Microsoft's utility to reset the Start and Stop dates for the recent Daylight Saving Time change. Of course, this worked correctly for the new start date but then the time got pushed up again at the old start date. I've since reset the system time to the correct value.

      Thanks in advance for shedding light on this problem.

        • 1. Re: TimeFormat(Now(),'h:mm tt')
          This probably has everything to do with daylight savings time. See http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=d2ab4470.

          Ted Zimmerman
          • 2. Re: TimeFormat(Now(),'h:mm tt')
            PHRED-SE Level 1
            Thanks for your reply. There is good and bad news here.
            Following through all the links from the one you sent me, I downloaded a file, dstDates.cfm (technote d2ab4470), which I installed and ran on both my production and development servers. On my production server, I saw that the dst changes had not been made, but I did get the correct time zones (cst, cdt, etc.) in the correct places for a system that has not been updated. When I ran it on my development system, all of the time zones said GMT!!! And they were showing the time as GMT time.

            Both systems are running the default MX jre (C:/CFusion/runtime/jre) and have the same JVM, 1.4.2-b28, which is shown in the dstTest results.

            I downloaded the JVM update, 1.4.2_11, and installed it. I then went into CF Admin and pointed CF to the new JVM location. I did this with some concern that the JVM Arguments would not be correct. This concern was not unfounded. CF would not start. I restored the original java.config file and CF started again.

            So I'm left knowing that my development server returns GMT times instead of local times on my development server and that my production server does not return the correct local time for several weeks during the year. Until I can get the new JVM to run correctly on my development server, I'm not going to try to install the new JVM on my production server.

            I've pasted in the results of the dstTest into the code window.

            Do you have any suggestions at this point???

            Thank you for your help so far.

            • 3. Re: TimeFormat(Now(),'h:mm tt')
              tzimmerman Level 1
              There shouldn't have been an issue with using a different jdk. It's possible when you edited the file something wasn't entered properly. Try changing the jvm.config so that you can use the 1.4.2_11 jdk. Do the following;

              1. Make a backup of the current jvm.config
              2. Comment out the current java.home as follows: #java.home=C:/CFusionMX7/runtime/jre
              3. Add a new java.home as follows (this presumes the default installation): java.home=C:/j2sdk1.4.2_11
              4. Save the jvm.config and start the server

              Ted Zimmerman
              • 4. Re: TimeFormat(Now(),'h:mm tt')
                PHRED-SE Level 1

                It worked this time. I didn't edit java.config before. I used the Java and JVM function on CFAdmin. It changed the JVM Arguements, which may have been the problem. By editing the java.config file with WordPad, I only changed the java.home.

                After CF restarted, the dates were still reading GMT when I ran dstTest so I went back into the TZ setup with Microsoft's editor and reset them. That didn't change anything so I changed my TZ to MDT and that worked; i.e., dstTest showed everything correctly -- all TZ's as MDT. I then reset my TZ to CDT and rebooted the server. Everything is working correctly now.

                What a PIA!!! By the way, I'm still using CFusionMX, 6.1.

                Thanks for all your help!!! I would not have been able to solve this problem without your help.