Pike v8.1 release 6

Method Calendar.YMD.dwim_day()


Method dwim_day

Day dwim_day(string date)
Day dwim_day(string date, TimeRange context)

Description

Tries a number of different formats on the given date (in order):

<ref>parse</ref> format                  as in
"%y-%M-%D (%M) -W%W-%e (%e)"  "2000-03-20 (Mar) -W12-1 (Mon)"
"%y-%M-%D"                    "2000-03-20", "00-03-20"
"%M%/%D/%y"                   "3/20/2000"
"%D%*[ /]%M%*[ /-,]%y"        "20/3/2000" "20 mar 2000" "20/3 -00"
"%e%*[ ]%D%*[ /]%M%*[ /-,]%y" "Mon 20 Mar 2000" "Mon 20/3 2000"
"-%y%*[ /]%D%*[ /]%M"         "-00 20/3" "-00 20 mar"
"-%y%*[ /]%M%*[ /]%D"         "-00 3/20" "-00 march 20"
"%y%*[ /]%D%*[ /]%M"          "00 20 mar" "2000 20/3"
"%y%*[ /]%M%*[ /]%D"          "2000 march 20"
"%D%.%M.%y"                   "20.3.2000"
"%D%*[ -/]%M"                 "20/3" "20 mar" "20-03"
"%M%*[ -/]%D"                 "3/20" "march 20"
"%M-%D-%y"                    "03-20-2000"
"%D-%M-%y"                    "20-03-2000"
"%e%*[- /]%D%*[- /]%M"        "mon 20 march"
"%e%*[- /]%M%*[- /]%D"        "mon/march/20"
"%e%*[ -/wv]%W%*[ -/]%y"      "mon w12 -00" "1 w12 2000"
"%e%*[ -/wv]%W"               "mon w12"
"%d"                          "20000320", "000320"
"today"                       "today"
"last %e"                     "last monday"
"next %e"                     "next monday"

Note

Casts exception if it fails to dwim out a day. "dwim" means do-what-i-mean.