Documentation
¶
Overview ¶
Package ptime provides functionality for implementation of Persian (Solar Hijri) Calendar.
Index ¶
- func Afghanistan() *time.Location
- func Iran() *time.Location
- type AmPm
- type Month
- type Time
- func (t Time) Add(d time.Duration) Time
- func (t Time) AddDate(years, months, days int) Time
- func (t Time) AmPm() AmPm
- func (t *Time) At(hour, min, sec, nsec int)
- func (t Time) Clock() (int, int, int)
- func (t Time) Date() (int, Month, int)
- func (t Time) Day() int
- func (t Time) FirstMonthDay() Time
- func (t Time) FirstWeekDay() Time
- func (t Time) FirstYearDay() Time
- func (t Time) Format(format string) string
- func (t Time) Hour() int
- func (t Time) Hour12() int
- func (t *Time) In(loc *time.Location)
- func (t Time) IsLeap() bool
- func (t Time) LastMonthDay() Time
- func (t Time) LastWeekday() Time
- func (t Time) LastYearDay() Time
- func (t Time) Location() *time.Location
- func (t Time) Minute() int
- func (t Time) Month() Month
- func (t Time) MonthWeek() int
- func (t Time) Nanosecond() int
- func (t Time) RMonthDay() int
- func (t Time) RYearDay() int
- func (t Time) RYearWeek() int
- func (t Time) Second() int
- func (t *Time) Set(year int, month Month, day, hour, min, sec, nsec int, loc *time.Location)
- func (t *Time) SetDay(day int)
- func (t *Time) SetHour(hour int)
- func (t *Time) SetMinute(min int)
- func (t *Time) SetMonth(month Month)
- func (t *Time) SetNanosecond(nsec int)
- func (t *Time) SetSecond(sec int)
- func (t *Time) SetTime(ti time.Time)
- func (t *Time) SetUnix(sec, nsec int64, loc *time.Location)
- func (t *Time) SetYear(year int)
- func (t Time) Since(t2 Time) int64
- func (t Time) String() string
- func (t Time) Time() time.Time
- func (t Time) Tomorrow() Time
- func (t Time) Unix() int64
- func (t Time) UnixNano() int64
- func (t Time) Weekday() Weekday
- func (t Time) Year() int
- func (t Time) YearDay() int
- func (t Time) YearWeek() int
- func (t Time) Yesterday() Time
- func (t Time) Zone() (string, int)
- func (t Time) ZoneOffset() string
- type Weekday
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Afghanistan ¶
Afghanistan returns a pointer to time.Location of Asia/Kabul
Types ¶
type AmPm ¶
type AmPm int
A AmPm specifies the 12-Hour marker.
type Month ¶
type Month int
A Month specifies a month of the year starting from Farvardin = 1.
const ( Farvardin Month = 1 + iota Ordibehesht Khordad Tir Mordad Shahrivar Mehr Aban Azar Dey Bahman Esfand )
List of months in Persian calendar.
List of Dari months in Persian calendar.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
A Time represents a moment in time in Persian (Jalali) Calendar.
func Date ¶
Date returns a new instance of Time.
year, month and day represent a day in Persian calendar.
hour, min minute, sec seconds, nsec nanoseconds offsets represent a moment in time.
loc is a pointer to time.Location and must not be nil.
func New ¶
New converts Gregorian calendar to Persian calendar and
returns a new instance of Time corresponding to the time of t.
t is an instance of time.Time in Gregorian calendar.
func Now ¶
Now returns a new instance of Time corresponding to the current time.
loc is a pointer to time.Location and must not be nil.
func Unix ¶
Unix returns a new instance of PersianDate from unix timestamp.
sec seconds and nsec nanoseconds since January 1, 1970 UTC.
loc is a pointer to time.Location and must not be nil.
func (Time) AddDate ¶
AddDate returns a new instance of Time for t.year+years, t.month+months and t.day+days.
func (Time) FirstMonthDay ¶
FirstMonthDay returns a new instance of Time representing the first day of the month of t.
func (Time) FirstWeekDay ¶
FirstWeekDay returns a new instance of Time representing the first day of the week of t.
func (Time) FirstYearDay ¶
FirstYearDay returns a new instance of Time representing the first day of the year of t.
func (Time) Format ¶
Format returns the formatted representation of t.
yyyy, yyy, y year (e.g. 1394) yy 2-digits representation of year (e.g. 94) MMM the Persian name of month (e.g. فروردین) MMI the Dari name of month (e.g. حمل) MM 2-digits representation of month (e.g. 01) M month (e.g. 1) rw remaining weeks of year w week of year RW remaining weeks of month W week of month RD remaining days of year D day of year rd remaining days of month dd 2-digits representation of day (e.g. 01) d day (e.g. 1) E the Persian name of weekday (e.g. شنبه) e the Persian short name of weekday (e.g. ش) A the Persian name of 12-Hour marker (e.g. قبل از ظهر) a the Persian short name of 12-Hour marker (e.g. ق.ظ) HH 2-digits representation of hour [00-23] H hour [0-23] kk 2-digits representation of hour [01-24] k hour [1-24] hh 2-digits representation of hour [01-12] h hour [1-12] KK 2-digits representation of hour [00-11] K hour [0-11] mm 2-digits representation of minute [00-59] m minute [0-59] ss 2-digits representation of seconds [00-59] s seconds [0-59] ns nanoseconds S 3-digits representation of milliseconds (e.g. 001) z the name of location Z zone offset (e.g. +03:30)
func (Time) LastMonthDay ¶
LastMonthDay returns a new instance of Time representing the last day of the month of t.
func (Time) LastWeekday ¶
LastWeekday returns a new instance of Time representing the last day of the week of t.
func (Time) LastYearDay ¶
LastYearDay returns a new instance of Time representing the last day of the year of t.
func (Time) Nanosecond ¶
Nanosecond returns the nanoseconds offset of t in the range [0, 999999999].
func (*Time) Set ¶
Set sets t.
year, month and day represent a day in Persian calendar.
hour, min minute, sec seconds, nsec nanoseconds offsets represent a moment in time.
loc is a pointer to time.Location and must not be nil.
func (*Time) SetNanosecond ¶
SetNanosecond sets the nanosecond offset of t.
func (*Time) SetUnix ¶
SetUnix sets t to represent the corresponding unix timestamp of
sec seconds and nsec nanoseconds since January 1, 1970 UTC.
loc is a pointer to time.Location and must not be nil.
func (Time) Time ¶
Time converts Persian date to Gregorian date and returns a new instance of time.Time
func (Time) Tomorrow ¶
Tomorrow returns a new instance of Time representing a day after the day of t.
func (Time) Yesterday ¶
Yesterday returns a new instance of Time representing a day before the day of t.
func (Time) ZoneOffset ¶
ZoneOffset returns the zone offset of t in the format of [+|-]HH:mm.