House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search cf-talk

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       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   

Home /  Groups /  ColdFusion Talk (CF-Talk)

Help! Can't I set a specific time zone for a ColdFusion App?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bob Wright
05/12/2008 06:41 PM

Hi... I'm new here. I've been programming CF for a while but I have never come across this problem yet.  I am really hoping someone here can help me. I built an application for a client in the mid-west, but serve it on a shared server on the east coast.  The client wants all the times on the site to show in central time not eastern time.  But I can't change the time on the server. And, I use time-math in so many places in this particular application. Isn't there some way to easily change the time zone of a particular application - like in the <cfapplication> or something?  Surely I can't be the first person to deal with this problem!  There must be an easy fix yes? Help? Bob

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mike Chabot
05/12/2008 07:00 PM

The easy fix is to change the time zone on the server, which you say you cannot do. I think you can pass a different timezone id as an argument to the jvm in cfadmin, but this wouldn't impact the database or anything else where the time zone is important. Google for Duser.timezone. -Mike Chabot ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
William Seiter
05/12/2008 07:01 PM

I believe the time is determined by the time on the server.  If you wanted to 'change it' for your application, you could easily create a function in your CF scripts.  Maybe call it 'aNow()' of appNow().  Set it up to return the same type of data returned by the now() command. Then add to your Application file the time 'offset' that you want to use. This way you would return a time offset by that function and still be able to use all of the dateformat, timeformat and other CF time functions without much of a hassle. William ---------------------------------- William Seiter ColdFusion Web Developer / Consultant http://william.seiter.com Have you ever read a book that changed your life? Go to: http://www.winninginthemargins.com Use PassKey: GoldenGrove You'll be glad you did. ::-----Original Message----- :: ::Sent: Monday, May 12, 2008 3:40 PM ::To: CF-Talk ::Subject: Help! Can't I set a specific time zone for a CF App? :: ::Hi... I'm new here. I've been programming CF for a while but I have never ::come across this problem yet.  I am really hoping someone here can help ::me. :: ::I built an application for a client in the mid-west, but serve it on a ::shared server on the east coast.  The client wants all the times on the ::site to show in central time not eastern time.  But I can't change the ::time on the server. And, I use time-math in so many places in this ::particular application. :: ::Isn't there some way to easily change the time zone of a particular ::application - like in the <cfapplication> or something?  Surely I can't be ::the first person to deal with this problem!  There must be an easy fix ::yes? :: ::Help? :: ::Bob :: :: :: :: ::

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby Hartsfield
05/12/2008 07:19 PM

You could store the time offset within an application variable then use that along with dateadd() within all of your dateformat and tiemformat calls throughout the application. You could also go as far as writing your own version of the now() function that does the dateadd math against now() ofr you and returns the results. then you could do a global find and replace on now() with your now() function. Just an idea. Then your dateformat for the current time might look like #dateformat(myNow(), 'mmm dd yyyy')# And time would look like... #timeformat(myNow(), 'hh:mm tt')# It would actually be cool if now() could accept and calculate an offset... Maybe something like now('h', -5) .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com Hi... I'm new here. I've been programming CF for a while but I have never come across this problem yet.  I am really hoping someone here can help me. I built an application for a client in the mid-west, but serve it on a shared server on the east coast.  The client wants all the times on the site to show in central time not eastern time.  But I can't change the time on the server. And, I use time-math in so many places in this particular application. Isn't there some way to easily change the time zone of a particular application - like in the <cfapplication> or something?  Surely I can't be the first person to deal with this problem!  There must be an easy fix yes? Help? Bob

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
05/12/2008 06:49 PM

> Isn't there some way to easily change the time zone of a > particular application - like in the <cfapplication> or > something?  Surely I can't be the first person to deal with > this problem!  There must be an easy fix yes? No, I don't think you can do this. Time info is provided by the OS. If you want to use an offset, it's up to you to keep track of that in your code. You might find this useful: http://www.cflib.org/udf.cfm?ID=719 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
05/12/2008 07:24 PM

> The easy fix is to change the time zone on the server, which > you say you cannot do. I think you can pass a different > timezone id as an argument to the jvm in cfadmin, but this > wouldn't impact the database or anything else where the time > zone is important. Google for Duser.timezone. It's very unlikely that you'll be able to change JVM arguments on a shared server. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mike Chabot
05/12/2008 10:51 PM

It depends on what is implied by "shared server." I think adding "-Duser.timezone=CST" inside of CF Admin, if this is an option, is easier than making site-wide code changes. If multiple instances of CF are running on the shared server, each instance can have its own independent JVM settings. -Mike Chabot > It's very unlikely that you'll be able to change JVM arguments on a shared > server. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists