timeparser

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 2 Imported by: 1

README

Time Parser for Golang

GitHub Releases Build Status codecov Go Report Card GoDevDoc Donate

timeparser provides flexibility in parsing time from string for Golang. It allows either RFC3339 or YMD.

Prerequisites

  • Go >= 1.16

Install

go get github.com/nhatthm/timeparser

Usage

func Parse(s string) (time.Time, error)

Parse a time in string to time.Time. s could be RFC3339 or YMD.

func ParsePeriod(from, to string) (start *time.Time, end *time.Time, err error)

Parse a time period from string to time.Time.

from and to could be RFC3339 or YMD. It is nil if the string is empty.

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Paypal donation

paypal

       or scan this

Documentation

Overview

Package timeparser provides functionalities for parsing time from string.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTimePeriod = errors.New("invalid time period")

ErrInvalidTimePeriod indicates that the time input is invalid.

Functions

func Parse

func Parse(s string) (time.Time, error)

Parse parses string into time.Time.

func ParsePeriod

func ParsePeriod(from, to string) (time.Time, time.Time, error)

ParsePeriod returns a time period from given input.

func TimePtr

func TimePtr(t time.Time) *time.Time

TimePtr returns a pointer to the given time.Time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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