Files
m3o-go/examples/time
2022-03-02 17:02:33 +00:00
..
2021-12-09 15:06:12 +00:00
2021-12-09 15:06:12 +00:00
2022-03-02 17:02:33 +00:00

Time

An m3o.com API. For example usage see m3o.com/time/api.

Endpoints:

Now

Get the current time

https://m3o.com/time/api#Now

package example

import(
	"fmt"
	"os"

	"go.m3o.com/time"
)

// Get the current time
func ReturnsCurrentTimeOptionallyWithLocation() {
	timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := timeService.Now(&time.NowRequest{
		
	})
	fmt.Println(rsp, err)
	
}

Zone

Get the timezone info for a specific location

https://m3o.com/time/api#Zone

package example

import(
	"fmt"
	"os"

	"go.m3o.com/time"
)

// Get the timezone info for a specific location
func GetTheTimezoneInfoForAspecificLocation() {
	timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := timeService.Zone(&time.ZoneRequest{
		Location: "London",

	})
	fmt.Println(rsp, err)
	
}