parent
a878df3603
commit
1111b4e102
@ -0,0 +1,2 @@ |
|||||||
|
date |
||||||
|
date.exe |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
|
||||||
|
|
||||||
|
build: |
||||||
|
go build .
|
||||||
@ -0,0 +1,3 @@ |
|||||||
|
module lcthw.dev/go/go-coreutils/date |
||||||
|
|
||||||
|
go 1.24.2 |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"time" |
||||||
|
"flag" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
var result string |
||||||
|
var universal bool |
||||||
|
|
||||||
|
it_is := time.Now() |
||||||
|
|
||||||
|
flag.BoolVar(&universal, "u", false, "UTC time.") |
||||||
|
flag.Parse() |
||||||
|
|
||||||
|
if universal { |
||||||
|
it_is = it_is.UTC() |
||||||
|
} |
||||||
|
|
||||||
|
if flag.NArg() == 1 { |
||||||
|
result = it_is.Format(flag.Args()[0]) |
||||||
|
} else { |
||||||
|
result = it_is.String() |
||||||
|
} |
||||||
|
|
||||||
|
fmt.Println(result) |
||||||
|
} |
||||||
Loading…
Reference in new issue