diff --git a/cmd/date.go b/cmd/date.go index a0e465a..14ef1da 100644 --- a/cmd/date.go +++ b/cmd/date.go @@ -2,6 +2,8 @@ package cmd import ( "fmt" + "strings" + "time" "github.com/cloudingcity/gool/pkg/date" "github.com/spf13/cobra" @@ -14,6 +16,11 @@ var dateToTimestampCmd = &cobra.Command{ Args: cobra.ExactArgs(1), DisableFlagsInUseLine: true, Run: func(cmd *cobra.Command, args []string) { + if strings.ToLower(args[0]) == "now" { + fmt.Println(time.Now().Unix()) + return + } + timestamp, err := date.ToTimestamp(args[0]) if err != nil { fmt.Println("Invalid date!")