Check out time.Parse <https://golang.org/pkg/time/#Parse>:

t := time.Parse("2006-01-02", inputString)
year := t.Year()
month := t.Month()
day := t.Day()

On Thu, Oct 20, 2016 at 5:06 AM, David Sofo <sofodav...@gmail.com> wrote:

>
> Hi,
> I ma new to Go Regex.
>
> I want to have a set of reusable rules of regex in golang easy to edit or
> update. For example a regex for date can be splitted in day, month and year
> :
>
> year=d{4}
> month=d{2}
> day=d{2}
>
> and for date we can have as following: date=year-month-day
>
>
> Is it possible in golang? Can we add human readable comment to regex?
>
> Any suggestion is welcome.
>
> Thank you
> David
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to