All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Get the Difference in Hours Between Two Dates in Go

In Golang, there are 2 ways to get the difference in hours between two dates. Using time.Since Function The time.Since() function returns the time elapsed since t. It is shorthand for time.Now().Sub(t). For example, package main import ( "fm...
Unused

How to Subtract a Day from a Date in Python

In Python, using the timedelta object is the easiest way to subtract a day from a date. Using timedelta Object A timedelta object represents a duration, the difference between two dates or times. See the following example: #!/usr/bin/python3 #...
Sambhav Khandelwal

How to Subtracting time.Duration from Time in Go

In Golang, using the time.Duration function is the easiest way to subtract time from a time.Time Using time.Duration Function A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the la...
Tomoki

How to Get the Current Time in Python

In Python, there are 2 ways to get the current time. Using datetime Module The datetime module supplies classes for manipulating dates and times. See the following example: #!/usr/bin/python3 # -*- coding: utf8 -*- # Import module import datet...
Patcher56

How to get the first and last day of the current month in Go

In Golang, there are two ways to get the start and end date of the current month.Using time.AddDate Function AddDate returns the time corresponding to adding the given number of years, months, and days to t. For example, package main import ( "fm...
Tomoki

How to format a date or time in Go

In Golang, there are two ways to format the time.The layout string Go doesn’t use yyyy-mm-dd layout to format a time. Instead, you format a special layout parameter. 2006-01-02 15:04:05.999999999 -0700 MST package main import ( "fmt" "tim...
aweis

Built-in Types in Python

Python’s Core Data Types.Core Data Types The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Built-in objects preview: Object type: Numbersint, float, complex.Strings'spam', "Bob's", b'a\x01c', u'sp\xc4m...
Unused

How to use the curl command in Linux

command line tool and library for transferring data with URLs. cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...

How to install Moment.js

A JavaScript date library for parsing, validating, manipulating, and formatting dates.--pname-- was designed to work both in the browser and in Node.js. All code should work in both of these environments, and all unit tests are run in both of these e...