Getting the TimeZone Name

May 10, 2004

CFML's function GetTimeZoneInfo will give you timezone offsets, and day light savings time information, but if you want the name of the timezone your ColdFusion server is in you can use java's TimeZone class:

<cfset tz = CreateObject("java", "java.util.TimeZone")>
<cfset tz = tz.getDefault()>
<cfoutput>TimeZone: #tz.getDisplayName()# (#tz.getID()#)</cfoutput>

The output when I run it is:

TimeZone: Eastern Standard Time (America/New_York) 

3 people found this page useful, what do you think?


you might find this thing useful:
Any idea how to (easily) find the abbreviations for the timezones... i.e. "CST" or "PST"?
Hi Pete very cool!!! I'll changed it a little and posted it on my own swiss blog. With a Link to your Entry, shurely. You can see it here:
You may also want to find another surgeon to get a second opinion, to confirm if surgery is the right treatment for you. ,
(Using CF 8.0.1)I struggled with geittng images to show in my PDF generated via CFDocument. The image would appear blank and I'd get the following error when I tried clicking on the image in the PDF: "There was an error processing an annotation or link. There was a problem reading the document (14).".I used absolute urls for the images and the PDF displayed them fine when on my local testing server but not on our production server. I have come to the conclusion that it was more a http/firewall issue possibly in my case.My fix:Within the html that I was converting to PDF using cfdocument, I made my image urls relative (ie. <img src="images/text_image.png"/>).I also added the localUrl="yes" attribute in the <cfdocument> tag.Using this, CF now looks for images in the document on the local drive, instead of making a http request to retrieve them. It is now working for me on both server environs.Cheers!Steve

Recent Entries


did you hack my cf?