From fe19d6a62e098a36fd736360d31aa938604791ef Mon Sep 17 00:00:00 2001 From: Anisuzzaman Khan Date: Mon, 24 Jun 2019 01:18:24 +0600 Subject: [PATCH] added weekday string method --- time/time.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/time/time.v b/time/time.v index a6ae9e08b0..29566e1fdc 100644 --- a/time/time.v +++ b/time/time.v @@ -133,6 +133,7 @@ pub fn (t Time) format() string { const ( Months = 'JanFebMarAprMayJunJulAugSepOctNovDec' + Days = 'MonTueWedThuFriSatSun' ) pub fn (t Time) smonth() string { @@ -332,3 +333,7 @@ pub fn (t Time) day_of_week() int { return day_of_week(t.year, t.month, t.day) } +pub fn (t Time) weekday_str() string { + i := t.day_of_week() - 1 + return Days.substr(i * 3, (i + 1) * 3) +}