A tiny library to represent DateTime in russian language
go get "github.com/ivahaev/russian-time"
import (
"fmt"
"github.com/ivahaev/russian-time"
"time"
)
// Get current local DateTime
t := rtime.Now()
// Or if you are using time.Time object:
standardTime := time.Now()
t = rtime.Time(standardTime)
// Get full string representation:
fmt.Println(t.String())
// Шестнадцатое июня две тысячи пятнадцатого года, один час, тридцать шесть минут, тридцать три секунды
// Get date string representation:
fmt.Println(t.DateString())
// Шестнадцатое июня две тысячи пятнадцатого года
// Get time string representation:
fmt.Println(t.TimeString())
// Один час, тридцать шесть минут
// Get time with seconds string representation:
fmt.Println(t.TimeStringWithSeconds())
// Один час, тридцать шесть минут, тридцать три секундыtype Month time.MonthBase type for month
func (m Month) String() (month string)Returns string representation of Month
func (m Month) StringInCase() (month string)Returns representation of Month in case: Января, Декабря...
type Time time.TimeBase type for DateTime. Can be converted from time.Time
func Now() TimeReturns current DateTime
func (t Time) DateString() (result string)Returns date string representation of Time
func (t Time) DayString() (result string)Returns string representation of Day of Month
func (t Time) Hour() intReturns the hour within the day specified by t, in the range [0, 23].
func (t Time) HourString() (result string)Returns string representation of Hour
func (t Time) Minute() intReturns the minute offset within the hour specified by t, in the range [0, 59].
func (t Time) MinuteString() (result string)Returns string representation of Minute
func (t Time) Month() MonthReturns int month [0,12]
func (t Time) Second() intReturns the second offset within the minute specified by t, in the range [0,59].
func (t Time) SecondString() (result string)Returns string representation of Second
func (t Time) String() (result string)Returns full string representation of Time
func (t Time) TimeString() (result string)Returns time string representation of Time without seconds
func (t Time) TimeStringWithSeconds() (result string)Returns time string representation of Time with seconds
func (t Time) Weekday() WeekdayReturns specifies a day of the week (Sunday = 0, ...).
func (t Time) Year() intfunc (t Time) YearString() (year string)Returns string representation of Year
func (t Time) YearStringInCase() (year string)Returns string representation of Year in case: Двухтысячного года, Одна тысяча девятьсот четертого года
type Weekday time.WeekdayA Weekday specifies a day of the week (Sunday = 0, ...).
func (w Weekday) String() (weekday string)Returns string representation ofWeekday