Skip to content

Commit

Permalink
Novos medotos de datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-couto committed Mar 22, 2021
1 parent 4c370b4 commit 18786c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions conversoes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
const LAYOUT_DDMMYYYY = "02012006"
const LAYOUT_DD_MM_YYYY = "02/01/2006"
const LAYOUT_DD_MM_YYYY_HH_MM_SS = "02/01/2006 15:04:05"
const LAYOUT_YYYY_MM_DD_HH_MM_SS = "2006-01-02 15:04:05"
const LAYOUT_YYYYMMDD = "20060102"
const LAYOUT_YYMMDDHHMMSS = "060102150405"
const LAYOUT_YYYYMMDDHHMMSS = "20060102150405"
Expand Down Expand Up @@ -86,6 +87,14 @@ func ConvertStringToTimeLayoutYYYYMMDDHHMMSS(value string) time.Time {
return t
}

func ConvertStringToTimeLAYOUT_YYYY_MM_DD_HH_MM_SS(date time.Time) string {
return date.Format(LAYOUT_YYYY_MM_DD_HH_MM_SS)
}

func ConvertStringToTimeLAYOUT_YYYY_MM_DD(date time.Time) string {
return date.Format(LAYOUT_YYYY_MM_DD)
}

func ConvertStringToTimeLayoutYYYY_MM_DDTHH_MM_SS_000Z(value string) time.Time {
t, _ := time.Parse(LAYOUT_YYYY_MM_DDTHH_MM_SS_000Z, value)
return t
Expand Down

0 comments on commit 18786c0

Please sign in to comment.