timezone

How do I set the timezone in Tomcat for a single web app?

What is the best way to set the time zone in Tomcat for a single web app? I've seen options for changing the command-line parameters or environment variables for Tomcat, but is there a way to set it that is self-contained in the WAR file and not dependent on any Tomcat configuration? Edit: to reemphasize, I'm looking for a solution that...

How can I parse a date including timezone with Joda Time

This snippet of code always parses the date into the current timezone, and not into the timezone in the string being parsed. final DateTimeFormatter df = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss 'GMT'Z yyyy"); final DateTime dateTime = df.parseDateTime("Mon Aug 24 12:36:46 GMT+1000 2009"); System.out.println("dateTime = " + d...

Rails BST timezone implementation

Does anyone know how i can use BST for config.time_zone in my rails config/environment.rb file? At the moment i have left it as UTC and i'm thinking of adding BST to the list of supported timezones, and then extending the Time class to respect this (> last sunday of X month + 1hr) Where can i find the list of supported timezones? Sear...

How to store a datatime as UTC in php/mysql?

Everywhere I read about converting time to a users timezone time says the best method is to store a date adn time in UTC then just add the users timezone offset to this time. So I am wanting to know, how can I store a date in UTC time, I use mysql's DATETIME field. When adding a new record to mysql in my PHP code I would use NOW() to...

WCF converting time based on timezone automatically

Hi, I am using WCF service which returns current time of the server. My Client is in different time zone. When I call this service, It is automatically converting the time returned by the server to local time, which I do not want. How do i ignore this? ...

Find out the time since unix epoch for a certain date time?

I want to find out the time in unix time (ie seconds since the unix epoch) on 9:00 BST on 1st October 2009. How can I do this on the linux command line? I know you can use date @$UNIXTIME '+%someformat', but the unix time is what I'm trying to figure out ...

python DST and GMT management into a scheduler

I'm planning to write a sheduler app in python and I wouldn't be in trouble with DST and GMT handling. As example see also PHP related question 563053. Does anyone worked already on something similar? Does anyone already experienced with PyTZ - Python Time Zone Library? ...

pytz localize vs datetime replace

I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments to the localized datetime: .localize behaviour: >>> tz <DstTzInfo 'Africa/Abidjan' LMT-1 day, 23:44:00 STD> >>> d datetime.datetime(2009, 9, 2, 14, 45, 42, 91421) >>> tz.localize(d) datetime.datetime(2009, 9, 2, 14, 45, 42, 91421, ...

How do I use GMT times in postgresql?

We are running about in our java code with GregorianCalendar. We would like to persist these in our postgresql database as GMT +0 time in timestamp type columns, but we're not sure how to go about it. Should the fields be with time stamp or without? By a similar token which "current" time postgres function should we be using current_time...

TZ Var to Java TimeZone?

I need to convert from the Unix TZ variable of the form: stdoffset[dst[offset][,start[/time],end[/time]]] into a Java TimeZone object. For example, convert AEST-10AEDT-11,M10.1.0/02:00:00,M4.1.0/03:00:00 into a Java TimeZone object that represents "Australia\Sydney". Before I go and write the code myself I'd like to know I'm not inventi...

Is there a way to get a timeZone with (only) a country code (valid ISO-3166 code) ?

Hi everybody, I'm trying to get a TimeZone for a user. For this I have a country code which is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.chemie.fu-berlin.de/diverse/doc/ISO%5F3166.html I think th...

Displaying tweets in my website using my timezone

Hello everyone. I am able to display my tweets in my website using the JavaScript below. window.onload = function() { var siteName = 'xyz'; $.getJSON( 'http://search.twitter.com/search.json?callback=?&amp;rpp=20&amp;q=from:' + siteName, function(data) { $.each(data, function(i, tweets) { ...

Python: display the time in a different time zone

Hi, Is there an elegant way to display the current time in another time zone? I would like to have something with the general spirit of: cur=<Get the current time, perhaps datetime.datetime.now()> print "Local time ", cur print "Pacific time ", <something like cur.tz('PST')> print "Israeli time ", <something like cur.tz('IST')> An...

PHP time ahead of MySQL time

I run PHP and MySQL on the same machine, but both report different times. I set the timezones by the following methods: PHP: date_default_timezone_set('Asia/Kuala_Lumpur'); MySQL: SET time_zone = "Asia/Kuala_Lumpur"; The difference between two times is always exactly 24 seconds. Any idea why this is happening? I thought the times...

Weird time inconsistencies between production and development

For some reason times are appearing differently in development (my local Mac) and production (Heroku). Take a look: (Just prior to doing this I did a heroku db:pull, so the databases should be identical) Production (Heroku) >> Annotation.last.id => 2028 >> Annotation.last.created_at => Sat, 12 Sep 2009 06:51:33 UTC +00:00 >> Time.zone ...

pytz: Why is normalize needed when converting between timezones?

Hi I'm reading the not so complete pytz documentation and I'm stuck on understand one part of it. Converting between timezones also needs special attention. This also needs to use the normalize method to ensure the conversion is correct. >>> utc_dt = utc.localize(datetime.utcfromtimestamp(1143408899)) >>> utc_dt.strftime(fmt) '200...

How to deal with time zones in a Rails app with events...

I have a Rails app for bands. Bands can import their shows which all occur in different time zones. It seems like a ton of work to store these events in UTC. I would have to figure out the time zone for any show created and then convert back to the show's local time zone when displaying to the user. Is there a simple plugin to get a ...

TimeZone information in .NET 2.0

Could anybody suggest a third party library in .net which could provide Time Zone information and meet these requirements Which supports .NET 2.0 not .net 3.5 Note: (.NET 3.5 has a class called TimeZoneInfo). Mono compatible Ta, Rajeesh ...

how to overwrite the timezone of the server in a sub application

This is a quicky, what do I need to setup a different timzone in my application than that setup on IIS All i want is to show a specific date in AESP rather than SPT, ist here a way in C# .NET 3.5? ...

Adjusting time zone in PHP with DateTime / DateTimeZone

There's a lot of info on doing time zone adjustments in PHP, but I haven't found an answer for specifically what I want to do due to all the noise. Given a time in one timezone, I want to convert it to the time in another timezone. This is essentially what I want to do, but I need to be able to do it using only the built-in PHP libs, ...