mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
add parse datetime method
This commit is contained in:
@@ -45,6 +45,11 @@ func ParseFromLongDateTime(t string, utcOffset int16) (time.Time, error) {
|
|||||||
return time.ParseInLocation(longDateTimeFormat, t, timezone)
|
return time.ParseInLocation(longDateTimeFormat, t, timezone)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseFromLongDateTimeWithoutSecond parses a formatted string in long date time format (no second)
|
||||||
|
func ParseFromLongDateTimeWithoutSecond(t string, timezone *time.Location) (time.Time, error) {
|
||||||
|
return time.ParseInLocation(longDateTimeWithoutSecondFormat, t, timezone)
|
||||||
|
}
|
||||||
|
|
||||||
// ParseFromShortDateTime parses a formatted string in short date time format
|
// ParseFromShortDateTime parses a formatted string in short date time format
|
||||||
func ParseFromShortDateTime(t string, utcOffset int16) (time.Time, error) {
|
func ParseFromShortDateTime(t string, utcOffset int16) (time.Time, error) {
|
||||||
timezone := time.FixedZone("Timezone", int(utcOffset)*60)
|
timezone := time.FixedZone("Timezone", int(utcOffset)*60)
|
||||||
|
|||||||
Reference in New Issue
Block a user