[45] Results

Golang : Convert int(year) to time.Time type

golang integer-time convert

Problem :

You have integer value such as a year and you want to convert the integer to time.Time type.….... read more

Golang : Convert seconds to minutes and remainder seconds

golang seconds minutes time


You have an input seconds in integer that you want to convert into minutes and remainder seconds. How to….... read more

Golang : calculate elapsed run time

golang elapsed-run-time

Calculating elapsed time can be useful for profiling or bench marking purpose. In this short tutorial, we will learn how….... read more

Golang : Get current time

golang get-current-time

Problem : Need to get current time stamp in Go and display in string. Solution : Use the time.Local() and time.Format() functions. getcurrenttime.go package main….... read more

Golang : Get current time from the Internet time server(ntp) example

golang time-zone synchronize-time network-time-protocol

There are times when a program needs to have accurate machine time. For example, the make command found in Unix/Linux.….... read more

Golang : Measure execution time for a function

golang measure-function-time execution-time footer

Ok, this is another way to measure execution time of a Golang function. This method uses defer and produce a….... read more

Golang : ISO8601 Duration Parser example

golang iso8601 duration-parser time

An example on how to parse ISO-8601 duration in string format and convert it to time.Duration type. However, this example….... read more

Golang : How to get time zone and load different time zone?

golang time-zone load-location

Problem :

You need to get current time zone and load different time zone. How to do that in Golang?

.... read more