Javatpoint Logo
Javatpoint Logo

Go Time

Go has very good support for the time manipulations. Unix epoch time is used as reference for time manipulations.

we can built a time object by using Date method provided in the time package. The package contains methods like year(), month(), day(), location() etc.

We invoke these methods by using time object.

Go Time Example

Output:

2017-10-04 17:10:13.474931994 +0530 IST m=+0.000334969
1993-02-28 09:04:39.000000213 +0530 IST
1993
February
28
9
4
39
213
Local
Sunday
true
false
false
215624h5m34.474931781s
215624.09290970326
1.2937445574582197e+07
7.762467344749318e+08
776246734474931781
2017-10-04 17:10:13.474931994 +0530 IST
1968-07-25 00:59:04.525068432 +0530 IST

Process finished with exit code 0

Go Time Example 2

Output:

Today :  Wed, Oct 4, 2017 at 5:15pm
someTime equals to now ? :  false
30th March 2017 was 188 days ago 

Next TopicGo Epoch





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA