how to set the time zone of INDIA in rails 3 - ruby-on-rails-3
I am fresher in rails,
how to set the time zone of INDIA in rails 3 ?
where to specify this?
Please help.
In your config/application.rb, add this
config.time_zone = 'Kolkata'
That should work.
Later you can confirm this by running the following in rails console
>> Time.zone
#output
(GMT+05:30) Kolkata
You may just run 'rake time:zones:all' in your shell, you will find all the Timezones displayed for using in Rails development. From the above you can easily find INDIAN timezone as shown below.
* UTC +05:30 *
Chennai
Kolkata
Mumbai
New Delhi
Put any of the above names in your config/application.rb as follows:
config.time_zone = 'Chennai'
Just restart the server and you will find the timezone updated.
Thank you.
Related
celery the timezone not same the backend redis
I already set celery4.4 config timezone is "Asia/Shanghai" CELERY_TIMEZONE = "Asia/Shanghai" And the terminal show now datetime. 2021-08-20 23:26:03,849 But the backend I use redis date_zone is not the same as the datetime now. "date_done": "2021-08-20T15:26:03.848352" I dont know where my config is wrong.
Currently as documented, the resulting date_done isn't based on the configured Celery timezone but rather is just always UTC. That is why you are seeing 15:26 (UTC) instead of 23:26 (UTC+8). https://docs.celeryproject.org/en/stable/reference/celery.result.html#celery.result.AsyncResult.date_done https://docs.celeryproject.org/en/stable/internals/reference/celery.backends.database.models.html property date_done UTC date and time. This feature has already been requested before but seems to be always de-prioritized and moved for next release. Currently, it is planned to be included in Celery 5.2. The celery result column, date_done is utc, even though you set the timezone
How to set time zone to frecnh zone + windows ce
I need to set my timezone in my mobile device to french zone in c# (windows embedded ce) how can I do this please?
You can use this library to ease your development: https://opennetcf.codeplex.com/ I'm using it and setting the time zone through the following objects: TimeZoneCollection, TimeZoneInformation, DateTimeHelper.
You can not set the TimeZone to a city/location, you can only set the DST data. See my post here: http://community.intermec.com/t5/Device-Management/change-Time-Zone-with-xml/m-p/17007/highlight/true#M1023 ============================================================ You can not set the name of a TimeZone using the registry! You only can set the Offset and DST values. The clock panel then uses a matching entry. In the registry, the values for "GMT-7 (Mountain US)" and "GMT-7 (Arizona)" are nearly the same [HKEY_LOCAL_MACHINE\Software\Microsoft\Clock] "AppInfo"=hex(3):01,00,00,00,80,01,00,00,0f,00,00,00,00,00,00,00,00,00,00,00,3a,01,00,00,69,00,00,00,00,00,00,00,01,00,00,00 "AppState"=hex(3):11 "AutoDST"=dword:00000000 "GMT_OFFSET"=dword:000001A4 "HomeDST"=dword:00000000 "NetworkTimeNotifyUser"=dword:00000001 "NetworkTimeSync"=dword:00000001 "TZIndex"=dword:00000004 (see also http://peterfoot.net/HomeAndVisitingClocksInProfessionalEdition.aspx) and [HKEY_LOCAL_MACHINE\Software\Microsoft\Clock] "AppInfo"=hex(3):01,00,00,00,80,01,00,00,0a,00,00,00,00,00,00,00,01,00,00,00,3a,01,00,00,69,00,00,00,00,00,00,00,01,00,00,00 "AppState"=hex(3):11 "AutoDST"=dword:00000000 "GMT_OFFSET"=dword:000001A4 "HomeDST"=dword:00000001 "NetworkTimeNotifyUser"=dword:00000001 "NetworkTimeSync"=dword:00000001 "TZIndex"=dword:00000004 But, as you can see, there is no Name String of the time zone. [HKEY_LOCAL_MACHINE\Time] "TimeZoneInformation"=hex(3):a4,01,00,00,55,00,53,00,20,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,53,00,74,00,61,00,6e,00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,55,00,53,00,20,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,44,00,61,00,79,00,6c,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,c4,ff,ff,ff and [HKEY_LOCAL_MACHINE\Time] "TimeZoneInformation"=hex(3):a4,01,00,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,53,00,74,00,61,00,6e,00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,00,00,00,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,44,00,61,00,79,00,6c,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00,c4,ff,ff,ff These are the TimeZoneInformations (the TIME_ZONE_INFORMATION structure). Clipboard02.gif You may query the timezone city db as done in the attached file (TZ-cities.txt). The attached tool (timezoneset.exe) can be used to change the offset of the current active timezone. The time zone informations for Prague and Berlin are the same: index: 95 short name: GMT+1 Prague,Budapest name: Central Europe Standard Time GMT offset: -60 dst name: Central Europe Daylight Time DST offset: 0 ... index: 110 short name: GMT+1 Berlin,Rome name: W. Europe Standard Time GMT offset: -60 dst name: W. Europe Daylight Time DST offset: 0 except for the dst name. It is no good idea to set timezone informations using the registry.
Heroku migration from Cedar to Bamboo, how to convert PST stored dates into UTC
I have an application running on Heroku Bamboo and I need to migrate it to Cedar, but I have a problem with dates, because of my default_timezone: # config/application.rb config.time_zone = "Brasilia" config.active_record.default_timezone = :local With this configuration AR saves the date fields using PST (which is the :local value for Bamboo). But it doesn't save the TZ info in the date fields, it only offsets the dates to PST, for example the values on PG are like 2015-01-26 17:20:00 with no TZ info. After the Cedar migration and because of :local, AR assumes that 2015-01-26 17:20:00 is in UTC, causing wrong date values. If I set heroku config:set TZ=America/Los_Angeles and use my_date_field.in_time_zone for all my date fields in the interface, it works on Cedar, but I doesn't feel that right. Any ideas on other ways to fix that? Problem solved After setting ruby 1.9.2 on Cedar (default is 2.0) and with TZ set to America/Los_Angeles it worked in the same way it was working on Bamboo without requiring .in_time_zone. Although I still don't know why 2.0 requires .in_time_zone to return the time using the TZ configured with config.time_zone.
Tibco xpath daylight saving issue
Does anyone here knows how to solve the Tibco xpath daylight saving date issue. The issue was we have one record 03/10/2013 02:00 parsed via Tibco mapping palette with following format (mm/dd/yyyy hh:mm). However, it got invalid date time error with above date. It worked with all other times, e.g. 03/10/2013 01:00, 03/10/2013 03:00, just not working with anytime between 03/10/2013 02:00 ~ 03/10/2013 02:59. The current xpath we using parse-dateTime(format, string) So, can xpath detect the daylight saving automatically with the inbound date format (mm/dd/yyyy hh:mm) and parse it? Thanks so much. James
Yes. The TIBCO function that parses dateTime does detect Day Light Saving. I think you have two options to handle these cases in your engine. Change the code to have a Java Code parse the dateTime. I am aware that java correctly returns the time with 1 hour added in this case. You should be able to do a TimeZone.getDefault() to get the server's default TimeZone. Change the java default timezone in the TRA - java.property.user.timezone in the designer.tra I suppose. I have not tried these. :-)
I had the same problem with DST, trying to parse string 2014-03-30 02:00:00 which does not exist in italian timeZone. Since the input date was perfectly legit (intended to be in GMT+0) I solved by forcing the timezone with this code. It should work with any other timezone as long as it doesn't support DST. tib:parse-dateTime("yyyy-MM-dd HH:mm:ss Z"), concat($Start/root/dateTimeFrom, ' +0000')
Enable daylight in deployment.yaml (kubernetes) - name: BW_JAVA_OPTS value: "-Dbw.engine.enable.memory.saving.mode=true -Xms1024m -Xmx4096m"
Rails TimeZone Wrong?
I have a problem with timezone "Santiago". Chile changed to daylight time (GMT -3) from 1st september. Time.now.in_time_zone("Santiago") => Tue, 04 Sep 2012 10:57:43 CLT -04:00 <<-- wrong, should be 11:57:43 CLT -03:00 Any idea? Thanks.
Timezone data is provided by the tzdata gem. Rails requires a rather up to date version (iirc at least 0.3.31 for Rails 3.2.8), but as time zone definitions are rather short lived, sometimes you need to update them manually. In your case, you need at least 0.3.32 which includes the changes of the Chile DST. At the time of writing of this answer, the current version of tzdata is 0.3.33. To force a newer version of tzdata, just add this to your Gemfile: gem 'tzdata', '~> 0.3.33'