We can get the current date and time with a timestamp in local with the help of Location() function and other timezones in Golang with the help of LoadLocation() function. The LoadLocation() takes a string(city name) as parameter and returns the place.
.location() takes no parameter and return location .time.now() returns current date and time with a timestamp in local.
1. location(): It takes no parameter and returns local time.
2. func LoadLocation(name string) (*Location, error): It takes the place name as a parameter. Returns the location with the given name or return nil as an error.
3. time.Now() : It return current time.
Location : Local Time : 2009-11-10 23:00:00 +0000 UTC m=+0.000000001
Location : America/New_York Time : 2009-11-10 18:00:00 -0500 EST
- How to Get Current Date and Time in Various Format in Golang?
- time.Time.Local() Function in Golang with Examples
- Convert timestamp to readable date/time in PHP
- time.Time.Date() Function in Golang with Examples
- Get current timestamp using Python
- How to get the current date and time in seconds?
- Java Program to Display Current Date and Time
- How to Get Current time in Golang?
- Java Program to Display Current Hour and Current Minute
- Java Program to Convert Date to TimeStamp
- time.Date() Function in Golang With Examples
- How to Print Specific date-time in Golang?
- Golang Program that uses func as Local Variable
- How to convert timestamp to time ago in PHP ?
- How to Get the Current Working Directory in Golang?
- How to Get Current Weekday in Golang?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.