Time Formatting _ Golang

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Go supports time formatting and parsing via pattern-based layouts

Package Mainimport ("FMT"    " Time") Func main () {p:=FMT. Println T:=Time . Now () p (T.format (time. RFC3339)) T1, E:= time. Parse (time. RFC3339,"2012-11-01t22:08:41+00:00") p (T1) p (e) P (T.format ("3:04pm")) p (T.format ("Mon Jan _2 15:04:05 2006")) p (T.format ("2006-01-02t15:04:05.999999-07:00") ) Form:="3 PM"T2, E:= time. Parse (Form,"8 PM") p (T2) fmt. Printf ("%d-%02d-%02dt%02d:%02d:%02d-00:00\n", T.year (), T.month (), T.day (), T.hour (), T.minute (), T.second ()) Ansic:="Mon Jan _2 15:04:05 2006"_, E= time. Parse (Ansic,"8:41pm") P (e)}
 --Geneva-26T13: -: -+ ,:xx -- One- on  A: ,: A+0000+0000<nil>1: 17PMThu Mar -  -: -: -  - --Geneva-26T13: -:25.012512+ ,:xx0000- on- on  -: A:xx+0000UTC --Geneva-26T13: -: --xx:xxparsing Time"8:41pm"  as "Mon Jan _2 15:04:05 2006": Cannot parse"8:41pm"  as "Mon"

Summarize:

1: ....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.