Advertisement
kreangkrai

Untitled

Jul 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.33 KB | None | 0 0
  1. func GenID() {
  2.     type bondChaincode struct {
  3.         YYMM  string
  4.         Count int
  5.     }
  6.  
  7.     yymm := time.Now().Format("0602")
  8.  
  9.     bondCC := bondChaincode{}
  10.     bondCC.YYMM = yymm
  11.     bondCC.Count = bondCC.Count + 1
  12.  
  13.     iStr := strconv.Itoa(bondCC.Count)
  14.     for len(iStr) < 6 {
  15.         iStr = "0" + iStr
  16.     }
  17.     // format YYMMxxxxxx
  18.     fmt.Println(yymm + iStr)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement