I store my dates in the database as 'datetime', and I use i.e. DateTime.now for getting the current date and time and doing time arithmetic. I have set neither config.time_zone nor a default locale in config/application.rb
When outputting such a time value, I just convert it to string, i.e. "#{my_timestamp}", which gives me the UTC time like this:
"2014-07-27 11:41:50 UTC"
This is exactly what I want to have. There are, however, cases (for debugging output), where I would like to print for conveniece the local time for such a timestamp, in addition to the UTC time. "local time" means in this case the time as defined as local on the host where the Rails server (WEBrick) is running. Note that the shell, from where I start the server, does NOT have the environment variable TZ set.
Now my question:
From the viewpoint of Rails, does the term "local time" make any sense (given that I have neither TZ nor config.time_zone)?
If yes, how can I format the DateTime object in a way that it shows the time in local time?
If not, what would be the best approach in this case?
I've already looked at the DateTime member functions to see, whether there is something like "getlocal" or "localtime", but there doesn't seem to be one. to_formatted_s looked promising, but I didn't find anysthing in the possible time format specifiers which would help me here.
Ronald