Browse Source

Merge pull request 'grmi的Date和DateTime类型添加ToString方法' (#30) from feature_grmi into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_GAAS_GFrame_BACKEND/pulls/30
Reviewed-by: weichenglei <chenglei.wei@le-it.com.cn>
pull/31/head
weichenglei 3 years ago
parent
commit
a38b9de0f0
3 changed files with 12 additions and 0 deletions
  1. +5
    -0
      grmi/Date.go
  2. +5
    -0
      grmi/DateTime.go
  3. +2
    -0
      grmi/grmi.go

+ 5
- 0
grmi/Date.go View File

@ -30,3 +30,8 @@ func (self *Date) UnmarshalJSON(data []byte) error {
func (self *Date) Restore() time.Time {
return time.Time(*self)
}
func (self *Date) ToString() string {
date := self.Restore()
return date.Format(DateOutFormat)
}

+ 5
- 0
grmi/DateTime.go View File

@ -30,3 +30,8 @@ func (self *DateTime) UnmarshalJSON(data []byte) error {
func (self *DateTime) Restore() time.Time {
return time.Time(*self)
}
func (self *DateTime) ToString() string {
date := self.Restore()
return date.Format(DatetimeOutFormat)
}

+ 2
- 0
grmi/grmi.go View File

@ -16,6 +16,8 @@ type GoType int
const (
URLDateTimeFormat = "20060102150405"
URLDateFormat = "20060102"
DateOutFormat = "2006-01-02"
DatetimeOutFormat = "2006-01-02 15:04:05"
)
const (


Loading…
Cancel
Save