Text object’s value is in either of the following formats: YYYY-MM-DD HH:MM or YYYY-MM-DD then returns a new
DateTime object instantiated to that date and time. If this
Text object is not in one of these two formats it returns
var t = "2017-12-25 23:00" var d = t.to_date d.day_name # Monday.