42 lines
780 B
Go
42 lines
780 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"encoding/csv"
|
||
|
"fmt"
|
||
|
"time"
|
||
|
|
||
|
"gopkg.in/yaml.v3"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
fmt.Println("vim-go")
|
||
|
fb := bytes.NewReader(nil)
|
||
|
cr := csv.NewReader(fb)
|
||
|
records, err := cr.ReadAll()
|
||
|
fmt.Println(records, err)
|
||
|
fmt.Println(time.Now().String())
|
||
|
yesterday := time.Now().Add(-24 * time.Hour)
|
||
|
m := map[string]time.Time{
|
||
|
"Bala": time.Now(),
|
||
|
"Linus": yesterday,
|
||
|
}
|
||
|
data, _ := yaml.Marshal(&m)
|
||
|
fmt.Printf("%s\n", data)
|
||
|
//format := "2022-05-01T15:08:20.593630746-04:00"
|
||
|
format := "2006-01-02T15:04:05.999999999-07:00"
|
||
|
fmt.Println("============")
|
||
|
fmt.Println(yesterday.Format(format))
|
||
|
fmt.Println("============")
|
||
|
fmt.Println(yesterday.GoString())
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
|
||
|
Linus:
|
||
|
|
||
|
============
|
||
|
2022-04-30T15:14:40.302916106-04:00
|
||
|
2022-04-30T15:14:40.302916106-04:00
|
||
|
*/
|