month

package module
v0.0.0-...-3fa593e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2015 License: MIT Imports: 0 Imported by: 0

README

Image of insidethecpu

Go Month Package

Build Status godoc

Package month provides functionality pertaining to months of the year. The package is designed with developer productivity in mind, encapsulating some of the more verbose features of underlying Go packages, and exposing them intuitively. Examples of this include the ability to return the last day of any given month.

Month Icon

Installation

go get github.com/daishisystems/month

Sample Code

	// The last numeric day of January is 31
	m := month.January
	fmt.Printf("The last numeric day of %s is %d\n", m, m.LastDay(2015))

	// The last numeric day of February is 28
	m = month.February
	fmt.Printf("The last numeric day of %s is %d\n", m, month.February.LastDay(2015))

	// The last numeric day of February is 29
	m = month.February
	fmt.Printf("The last numeric day of %s is %d\n", m, m.LastDay(2008))

	// The last numeric day of July is 31
	m = month.July
	fmt.Printf("The last numeric day of %s is %d\n", m, m.LastDay(2015))

Contact the Developer

Please reach out and contact me for questions, suggestions, or to just talk tech in general.

RSSTwitterLinkedInYouTube

Documentation

Overview

Package month provides functionality, pertaining to months of the year, that is not available in standard Go libraries. Examples of this include the ability to return the last day of any given month.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Month

type Month int

Month represents a standard calendar month, applicable to integer format.

const (
	January Month = 1 + iota
	February
	March
	April
	May
	June
	July
	August
	September
	October
	November
	December
)

Standard calendar months.

func (Month) LastDay

func (m Month) LastDay(year uint16) int

LastDay returns the last day of m, based on year. The function takes into account leap years.

func (Month) String

func (m Month) String() string

String returns an English language based representation of m. E.g., January, February, etc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL