How to Get Current time in Golang? Last Updated : 21 Apr, 2020 Comments Improve Suggest changes Like Article Like Report With the help of time.Now() function, we can get the current time in Golang by importing time module. Syntax: time.Now() Return: Return current date and time. Example #1: In this example, we can see that by using time.Now() function, we are able to get the current date and time. C // Golang program to get the current time package main // Here "fmt" is formatted IO which // is same as C’s printf and scanf. import "fmt" // importing time module import "time" // Main function func main() { // Using time.Now() function. dt := time.Now() fmt.Println("Current date and time is: ", dt.String()) } Output : Current date and time is: 2009-11-10 23:00:00 +0000 UTC m=+0.000000001 Example #2: C // Golang program to get the current time package main // Here "fmt" is formatted IO which // is same as C’s printf and scanf. import "fmt" // importing time module import "time" // Main function func main() { // Using time.Now() function. dt := time.Now() fmt.Println(dt.Format("01-02-2006 15:04:05")) } Output: 11-10-2009 23:00:00 Comment More infoAdvertise with us Next Article How to Get Current time in Golang? J Jitender_1998 Follow Improve Article Tags : Go Language GoLang-time Similar Reads How to Get Current Weekday in Golang? With the help of time.Now().Weekday() function, we can get the weekday in Golang by importing time module. Syntax: time.Now().Weekday() Return: Return current weekday. Example #1: In this example, we can see that by using time.Now().Weekday() function, we are able to get the weekday. C // Golang pro 1 min read How to compare times in Golang? With the help of Before() and After() and Equal(), function we can compare the time as well as date but we are also going to use the time.Now() and time.Now().Add() function for comparison. Functions Used: These functions compares the times as seconds. Before(temp) - This function is used to check i 2 min read How to Get Current Time in JavaScript ? This article will show you how to get the current time in JavaScript. Whether you are creating a digital clock, scheduling events, or simply logging timestamps, knowing how to retrieve the current time is essential. Here, we will cover different methods to get the current time in JavaScript.Table of 2 min read How to Get Current Date and Time in Various Format in Golang? Package "time" in Golang provides functionality for measuring and displaying time. The calendrical calculations always assume a Gregorian calendar, with no leap seconds. Using the "time.Now()" function you can get the date and time in the "yyyy-mm-dd hh:mm:ss.milliseconds timezone" format. This is s 3 min read How to Print Specific date-time in Golang? Golang supports time formatting and parsing via pattern-based layouts. In Go, the current time can be determined by using time.Now(), provided by the time package. Package time provides functionality for measuring and displaying the time. To print Current date-time you need to import the "time" pack 2 min read How to get the current date and time in seconds ? In this article, we will learn how to get the current date & time in seconds using JavaScript build-in methods. We will perform it in 2 ways: Using Date.now() methodUsing new Date.getTime() methodMethod 1: Using Date.now() MethodThe Date.now() method returns the number of milliseconds elapsed si 2 min read Time Durations in Golang Operations related to time and date are a crucial part of software development (example log keeping). Go standard library provides a time package that has many functions and methods to deal with date and time. The operating system measures two types of time "Wall clock" time and "Monotonic" time. Wa 3 min read Get Current Timestamp Using Python A timestamp is a sequence of characters that represents the date and time at which a particular event occurred, often accurate to fractions of a second. Timestamps are essential in logging events, tracking files, and handling date-time data in various applications. There are 3 different ways to get 2 min read Time Formatting in Golang Golang supports time formatting and parsing via pattern-based layouts. To format time, we use the Format() method which formats a time.Time object. Syntax: func (t Time) Format(layout string) string We can either provide custom format or predefined date and timestamp format constants are also availa 2 min read How to pause the execution of current Goroutine? A Goroutine is a function or method which executes independently and simultaneously in connection with any other Goroutines present in your program. Or in other words, every concurrently executing activity in Go language is known as a Goroutines. So in Go language, you are allowed to pause the execu 2 min read Like