0 votes
in Ruby by
How to create a new time instance in Ruby?

1 Answer

0 votes
by

A new Time instance can be created with ::new. This will use your current system's time. Parts of time like year, month, day, hour, minute, etc can also be passed.

While creating a new time instance, you need to pass at least a year. If only year is passed, then time will default to January 1 of that year at 00:00:00 with current system time zone.

Related questions

0 votes
0 votes
asked Nov 15, 2021 in Ruby by Robin
0 votes
0 votes
asked Nov 11, 2021 in Ruby by SakshiSharma
...