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 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 find the intersection between two lists in Python

In Python, there are 4 ways to find the intersection between two lists. Using Set Intersection A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also sup...
Unused

How to find the difference between two lists in Python

In Python, there are 5 ways to find the difference between two lists. Using Set Difference A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support...
Sambhav Khandelwal

How to join a slice of strings into a single string in Go

Convert Slice to String in Golang.Using strings.Join Function Converting a slice of strings to a single string is pretty easy to do in Go. The strings.Join() method is present in the standard library for this purpose, and its usage is shown below: p...
Tomoki

How to find the difference between two slices in Go

Comparing two slices in Go.Using map cache Creates a slice of slice values not included in the other given slices. An implementation is shown in the section below. package main import "fmt" // difference returns the elements in `a` that aren't in ...
aweis

How to use the diff command in Linux

Compare FILES line by line. You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line o...

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 ...