Sphire Mantis' API Documentation
import "github.com/sphireinc/mantis/date"
func DaysInMonth(year, month int) (int, error)
DaysInMonth returns the number of days in a given month and year
func GetWeekDayName(date *Date) string
GetWeekDayName returns the name of the week day (e.g. “Monday”, “Tuesday”) for a given Date object
func IsLeapYear(year int) bool
IsLeapYear checks whether a given year is a leap year or not and returns a boolean value
func SubtractDates(date1, date2 *Date) (int64, time.Duration)
SubtractDates subtracts two Date objects and returns the duration between them in seconds or as a time.Duration object
func itos(intVal int) string
itos converts an int to a string, prepends zero if less than 10
Date struct
type Date struct {
Year int `json:"year"`
Month time.Month `json:"month"`
Day int `json:"day"`
Hour int `json:"hour"`
Minute int `json:"minute"`
Second int `json:"second"`
Nanosecond int `json:"nanosecond"`
Unix int64 `json:"unix"`
WeekDay time.Weekday `json:"week_day"`
YearDay int `json:"year_day"`
}
func AddDays(date *Date, days int) *Date
AddDays adds a given number of days to a Date object and returns a new Date object
func CurrentTime() Date
CurrentTime is a Date factory
func NewDate(year, month, day, hour, minute, second, nanosecond int) (*Date, error)
NewDate creates a new Date object from a given year, month, day, hour, minute, second, and nanosecond
func ParseDate(dateStr, format string) (*Date, error)
ParseDate parses a string representation of a date in a given format and returns a Date object
func StringToDate(date string) (Date, error)
StringToDate takes a date string YYYY-MM-DD HH:MM:SS and returns a Date struct
func (d *Date) DateToString(format string) (string, error)
DateToString converts a Date object to a string representation in a given format
func (d *Date) String() string
Generated by gomarkdoc