Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set the time zone of INDIA in rails 3

I am fresher in rails,

how to set the time zone of INDIA in rails 3 ?

where to specify this?

Please help.

like image 569
Thaha kp Avatar asked Jul 27 '12 11:07

Thaha kp


People also ask

How do you get the time zone in Ruby?

Ruby | Time zone() functionTime#zone() : zone() is a Time class method which returns the name of the time zone used for time like “UTC”, “GMT”.


1 Answers

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
like image 137
Kulbir Saini Avatar answered Nov 01 '22 17:11

Kulbir Saini