Remove ms from timestamp 【Ruby】
Apr 11, 2021
I tried out ruby ver 2.7, and found there was a new function.
Time.now
#=> 2021-04-11 14:43:57.854776
Ms was added. I couldn’t understand that someone said this was handy. Moreover, because in my project I wanted to remove this ms, I looked for the way.
It is below.
Time.now.change(:usec => 0)
#=> 2021-04-11 14:49:23
I managed to remove the ms!