Ruby 101 : Time and Date functions - Novice to Expert in ONE Day

Опубликовано: 19 Май 2026
на канале: Programming ByPracisting
135
2

In this video, we go over time and date functions provided by ruby. This is very useful if you're dealing with scripts that require parsing dates and comparing them to see if you should perform some action such as a script for cleaning up files older than 30 days.

Let's keep the momentum going to becoming ruby experts in a single day!

** QUIZ FOR THIS SESSION ** - https://goo.gl/forms/oN7cjl6ZkRlzump62

The functions we cover include
Creation
Time.now - create an instance of time object with current time and date
Time.new - creating date using custom year, month, day etc
Time.at - create time from an epoch time
Time.gmt - create time object in gmt time zone
Time.utc - create time object in UTC time zone
Time.local - create time object in local time zone

Comparison
.monday? , .tuesday? etc - check if the day of the time object is a particular day
.dst? - check if time object represents a date with daylight savings time enabled
Other comparison operators

Extraction
.year, .month etc to get values for those items from a time object

Comment below for any questions you want answered.
If you found this video useful, like and subscribe.
If you want to make my day, please follow me on social media

Twitter :   / progbypractise  
Facebook :   / programming-by-practising-1713777571991152   Website : http://programmingbypractising.wordpr...