Remove ms from timestamp 【Ruby】

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!

My LinkedIn account is below! Please contact me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/

--

--

Tomoharu Tsutsumi

Software Engineer with 4 + years of professional experience.