date

package
v0.0.0-...-345b6a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 4 Imported by: 0

README

Date

Display date and operate date.

Usage

$ show date -h
NAME:
   show date - show date

USAGE:
   show date command [command options] [arguments...]

COMMANDS:
   now      show current date
   add      add timestamp to current date
   convert  date conversion
   time     show current time
   help, h  Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help (default: false)

now

$ show date now -h
NAME:
   show date now - show current date

USAGE:
   show date now [command options] [arguments...]

DESCRIPTION:
   eg: show date now -f "2006-01-02"
   show date now --timestamp
   show date now --before "2011-11-11 08:10:10"
   show date now --after "2011-11-11 08:10:10"

OPTIONS:
   --format value, -f value  format date, it has no effect on --timestamp | --before | --after
   --timestamp, -t           show timestamp, unit: ms, it has no effect on --before | --after, (default: false)
   --before value, -b value  compare whether the date is before the specified date, this flag and --after are mutually exclusive
   --after value, -a value   compare whether the date is after the specified date, this flag and --before are mutually exclusive
   --help, -h                show help (default: false)

add

$ show date add -h
NAME:
   show date add - add timestamp to current date

USAGE:
   show date add [command options] [arguments...]

DESCRIPTION:
   add timestamp to current date by --millisecond | --second,
   if neither of this not set, the default is current date

   eg: show date add --millisecond 5000
   show date add --second 5
   show date add --second 5 --format "2006-01-02 15:04:05"
   show date add --second 5 --timestamp
   show date add --second 5 --before "2021-11-11 10:00:00"
   show date add --second 5 --after "2021-11-11 10:00:00"

OPTIONS:
   --millisecond value, -m value  add millisecond to current date (default: 0)
   --second value, -s value       add second to current date (default: 0)
   --format value, -f value       format date, it has no effect on --timestamp | --before | --after
   --timestamp, -t                show timestamp, unit: ms, it has no effect on --before | --after, (default: false)
   --before value, -b value       compare whether the date is before the specified date, this flag and --after are mutually exclusive
   --after value, -a value        compare whether the date is after the specified date, this flag and --before are mutually exclusive
   --help, -h                     show help (default: false)

convert

$ show date convert -h
NAME:
   show date convert - date conversion

USAGE:
   show date convert command [command options] [arguments...]

COMMANDS:
   timestamp  convert the specified date string into a timestamp, unit: ms
   date       convert the specified timestamp (unit: ms) into a date (the output layout: "2006-01-01 15:04:05") string
   help, h    Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help (default: false)

time

$ show date time -h
NAME:
   show date time - show current time

USAGE:
   show date time [command options] [arguments...]

DESCRIPTION:
   the flag --second and --millisecond are mutually exclusive, if both are specified, only --second is affected
   eg: show date time
   show date time --second
   show date time --millisecond
   show date time --clock 12h

OPTIONS:
   --clock value, -c value  show clock layout, 24h | 12h can be specified (default: 24h)
   --second, -s             show current time as seconds (default: false)
   --millisecond, -m        show current time as milliseconds (default: false)
   --help, -h               show help (default: false)

Documentation

Overview

Package date supports viewing date, formatted output, and conversion between timestamp and date, for example, if you want to know what date it is, you can execute a simple command "show date now", and the sample output like "2021-11-29 13:54:28.078364 +0800 CST m=+0.000846726", if you want to show as timestamp, you can execute command "show date now --timestamp", sometimes, we usually need to convert both timestamp and date, the best command "show date convert" maybe the best choice, for more information, you can execute "show date --help" to see.

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "date",
	Usage: `show date`,
	Subcommands: cli.Commands{
		commandNow,
		commandAdd,
		commandConvert,
		commandTime,
	},
}

Command provides a series of command and flag set for date.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL