Skip to content

saadullahsaeed/tareekh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tareekh

Build Status GoDoc

Tareekh is a GoLang library to make it a little bit easy to work with dates. This was written to avoid reimplementing common functionality working with time.Time.

Time zone

By default the Local timezone is used. But if you want to specify a particular timezone, just do:

tareekh.TimeZone = "America/New_York" //EST

Examples

Yesterday
yesterday := tareekh.Yesterday()
fmt.Println(yesterday) //yesterdays time object
FromDateString
dt, err := tareekh.FromDateString("2016-11-22")
if err != nil {
  //handle error
}
fmt.Println(t)
ToShortDate
t, _ := tareekh.FromDateString("2016-11-22")
shortDate := tareekh.ToShortDate(t)
fmt.Println(shortDate) //should print 2016-11-22
IsDateInFuture
future := time.Now().AddDate(0, 0, 1)
isit := tareekh.IsDateInFuture(future)
fmt.Println(isit) //should be true
BeginningOfMonth
begin := tareekh.BeginningOfMonth() //first of current month
EndOfMonth
end := tareekh.EndOfMonth() //last day of current month
FromDayOfMonth
dayx := tareekh.FromDayOfMonth(1) //specified day of current month

Status

In development, if there's other useful stuff feel free to fork and issue a pull request.

About

GoLang Lib for working with dates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%