It’s Zulu(UTC) time!
With my time zone set in my rails app I was getting the correct time in the console.
In rails C I would have the time on my smartphone match the echo from Time.now and Time.zone.now.
However I was getting the “incorrect” time on my records when they were saved to the DB. I say “incorrect” because they would show up in the call such as Model.all as off. If you targeted a specific record and asked it “hey, when are you created” it would tell you the correct time. I noticed they were always the same number of hours off for each record.
As you can see This is a record that was just created to the db. The time is shown as created_at “2020–03–25 19:31” below the current time is “2020–03–25 12:32”. The problem is, despite my time zone being set to “arizona” in my application.rb file and hence giving the correct time as determined by my smartphone, my database uses UTC.
Coordinated Universal Time or UTC is a standardized time and as you can see has the name ZULU time in this official site. You could say this is the time of the internet. It has this name for various reasons such as being the 0 meridian and it a standard that is accepted. There are a lot of resources about this you can search for. That is not the complete story and it also involves time since January 1 1970 and Unix.
There are a few different ways to work with UTC. One I found that really grabbed me is this and that there is a utc_offset(). UTC is not universal for all operating systems and UTC was derived
There are a few resources I’ve posted in the article you can click on. These will help you problem solve through the situation and get things working properly. Taking the time to get things set up correctly before you start to code away can save you days of work. I can attest to this as a developing developer. The good part is there are so many places out there to show you what to do.