I need to find out the time zone name of the local machine from Ruby (from the list of values โโof TZInfo :: Timezone.all_identifiers). I need this so that I can correctly set the time zone of the Oracle database session so that I can correctly handle the timestamp with the time zone values โโin the database.
I would like to get the same value as in Java, which can be obtained using java.util.TimeZone.getDefault (). getID () (which on my computer returns "Europe / Riga"). As I understood in the JDK sources, there are special C functions that define this default timezone.
Therefore, when using JRuby, I can call this Java method. But I need a solution that I can use with MRI.
I tried using Time.now.zone, but it returns different results (in my case โEETโ or โEESTโ) depending on whether daylight saving time is on or not. Therefore, I really need to enter the previously mentioned location format (for example, "Europe / Riga"), which correctly determines the dates when daylight saving time occurs.
Any suggestions?
source share