Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/aaronland/go-world-clock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/aaronland/go-world-clock

  • v0.0.0-20221103003751-ba4d0c9e509e
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-world-clock

There are many world clocks. This one is mine.

Documentation

Documentation is in progress and incomplete at this time.

Go Reference

Usage

import (
	"github.com/aaronland/go-world-clock"
	"log"
        "time"
)

func main(){

	now := time.Now()
	here := now.Local()

	filters := &clock.Filters{
		Timezones: []string{ "Montreal" },
	}

	results, _ := clock.Time(ctx, here, filters)

	for _, r := range results {
		log.Printf("%s %s\n", r.Timezone, r.Time.Format(time.RFC3339))
	}
}

Tools

time

Print the local time as well as the time in one or more timezones.

$> ./bin/time -h
Print the local time as well as the time in one or more timezones.

Usage:
	 ./bin/time [options]

Valid options are:
  -date string
    	YYYY-MM-dd HH:mm. If empty the current time in the computer's locale will be used.
  -in value
    	Zero or more strings to test whether they are contained by a given timezone's longform (major/minor) label.
  -timezone string
    	A valid major/minor timezone location. Required if -date is not empty.
Example:
$> ./bin/time  -in Melbourne -in Cairo -in Honolulu -in China -in Montreal -in London
Pacific/Honolulu         HST	Tuesday    2021-09-14 13:38
👉                       PDT	Tuesday    2021-09-14 16:38 👈
America/Montreal         EDT	Tuesday    2021-09-14 19:38
Europe/London            BST	Wednesday  2021-09-15 00:38
Africa/Cairo             EET	Wednesday  2021-09-15 01:38
Australia/Melbourne      AEST	Wednesday  2021-09-15 09:38

Or specifying a custom date in a timezone:

$> ./bin/time  -date '2021-09-15 03:00' -timezone 'Asia/Singapore' -in London -in 'Los_Angeles'
America/Los_Angeles      PDT	Tuesday    2021-09-14 12:00
Europe/London            BST	Tuesday    2021-09-14 20:00
👉                       +08	Wednesday  2021-09-15 03:00 👈

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc