Skip to content

English (en)

English is the default and most complete locale in whichtime.

Casual Dates

ExpressionMeaning
todayCurrent day
tomorrowNext day
yesterdayPrevious day
nowCurrent moment

Relative Dates

Past

ExpressionMeaning
X days agoX days in the past
X weeks agoX weeks in the past
X months agoX months in the past
X years agoX years in the past
last weekPrevious week
last monthPrevious month
last yearPrevious year

Future

ExpressionMeaning
in X daysX days from now
in X weeksX weeks from now
in X monthsX months from now
in X yearsX years from now
next weekComing week
next monthComing month
next yearComing year

Weekdays

ExpressionMeaning
Monday, MonWeekday 1
Tuesday, Tue, TuesWeekday 2
Wednesday, WedWeekday 3
Thursday, Thu, ThursWeekday 4
Friday, FriWeekday 5
Saturday, SatWeekday 6
Sunday, SunWeekday 0
next MondayComing Monday
last FridayPrevious Friday
this SaturdaySaturday of current week

Month Names

ExpressionMonth
January, Jan1
February, Feb2
March, Mar3
April, Apr4
May5
June, Jun6
July, Jul7
August, Aug8
September, Sep, Sept9
October, Oct10
November, Nov11
December, Dec12

Date Formats

FormatExample
MM/DD/YYYY12/25/2024
MM-DD-YYYY12-25-2024
Month DD, YYYYDecember 25, 2024
Month DDDecember 25
DDth of Month25th of December
YYYY-MM-DD (ISO)2024-12-25

Time Expressions

ExpressionTime
3pm15:00
3:30pm15:30
3:30 PM15:30
15:3015:30
3:30:4503:30:45
noon12:00
midnight00:00
morning~08:00 (implied)
afternoon~14:00 (implied)
evening~18:00 (implied)
night~20:00 (implied)

Combined Expressions

ExpressionResult
tomorrow at 3pmNext day at 15:00
next Monday at 9:30amComing Monday at 09:30
December 25th at noonDec 25 at 12:00
in 2 days at 5pm2 days from now at 17:00

Date Ranges

ExpressionResult
Monday to FridayWeekday range
from Monday to FridayWeekday range
January 1 to January 15Date range
from 9am to 5pmTime range

Examples

python
from whichtime import parse

# Casual
parse("today")
parse("tomorrow")
parse("yesterday")

# Relative
parse("in 2 hours")
parse("3 days ago")
parse("next week")
parse("last month")

# Weekdays
parse("Monday")
parse("next Friday")
parse("last Tuesday at 9:30")

# Explicit dates
parse("December 25, 2024")
parse("12/25/2024")
parse("2024-12-25")

# Times
parse("3pm")
parse("15:30")
parse("noon")

# Combined
parse("tomorrow at 3pm")
parse("next Monday morning")

Released under the MIT License.