Time _ Golang

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

Go ' s offers extensive support for times and durations; Here is some example

Package Mainimport ("FMT"    " Time") Func main () {p:=FMT. PRINTLN Now:=Time . Now () and then:=Time . Date ( the, One, -, -, the, -,651387237, time. UTC) P (then) p (then. Year ()) p (then. Month ()) p (then. Day ()) p (then. Hour ()) p (then. Minute ()) p (then. Second ()) p (then. Nanosecond ()) p (then. Location ()) p (then. Before (now)) p (then. After (now) p (then.) Equal (now)) diff:=Now . Sub (then) p (diff) p (diff. Hours ()) p (diff. Minutes ()) p (diff. Seconds ()) p (diff. nanoseconds ()) p (then. Add (diff)) p (then. ADD (-diff)}
 --Geneva- -  -: A:14.302895576+0800CST the- One- -  -: the:58.651387237+0000UTC theNovember - - the -651387237UTCtruefalsefalse46881h37m15.651508339s46881.621014307872.8128972608584724e+061.6877383565150833e+08168773835651508339 --Geneva- -  .: A:14.302895576+0000UTC2004- -- - Ten: $:42.999878898+0000Utc

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.