parseutil

package
v0.0.0-...-3518944 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2017 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateTime

func DateTime(value string) (time.Time, error)

DateTime parses a date with, optionally a time and a timezone in an RFC3339 style. The accepted formats are:

  • 2006-01-02 (interpred as 0 hour, 0 minute and 0 second)
  • 2006-01-02Z07:00 (same as the previous one, but with TZ)
  • 2006-01-02T15:04:05
  • 2006-01-02T15:04:05Z07:00 (time.RFC3339)
  • 2006-01-02T15:04:05.999999999Z07:00 (time.RFC3339Nano)

In all dates, the second number indicates the month and the third, the day. Number values less than ten must have a leading zero.

Note that the format Z07:00 indicates that the timezone can be specified as either Z (UTC) or either (+|-)hh:mm.

func Size

func Size(s string) (uint64, error)

Size parses a size with an optional suffix indicating the unit and returns the size in bytes Supported suffixes (case insensitive):

K, KB: kilobytes
M, MB: megabytes
G, GB: gigabytes
T, TB: terabytes

The number before the suffix is parsed as a float, so the size might be specified with decimal places like e.g. 1.5GB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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