FIND YOUR NEXT FEW LINES

Results for “Dates & time zones”

Small, practical examples. Search by task or narrow things down below.

293 snippets foundClear filters
C#Dates & precise numbers

Clamp a number to inclusive bounds

C#: Math.Clamp returns the nearest endpoint when the value lies outside the range.

C#✓ Tested
PowerShellDates & numeric validation

Clamp a number to inclusive bounds

PowerShell: Math.Clamp chooses the nearest endpoint for an out-of-range value.

PowerShell✓ Tested
PowerShellDates & numeric validation

Compute beyond the fixed-width integer range

PowerShell: BigInteger keeps an exact result when ordinary integer types are too small.

PowerShell✓ Tested
RustNumbers & durations

Construct an instant relative to the Unix epoch

Construct an instant relative to the Unix epoch in a complete Rust program using the standard library.

Rust✓ Tested
Linux CommandsDates & process utilities

Copy a file with explicit permissions

Linux Commands: Use install to create parent directories and set the destination mode in one operation.

Linux Commands✓ Tested
C#Dates & precise numbers

Detect integer overflow with checked

C#: A checked arithmetic block throws instead of silently wrapping an integer result.

C#✓ Tested
C#Dates & precise numbers

Find the length of a calendar month

C#: DaysInMonth applies the Gregorian leap-year rules.

C#✓ Tested
PowerShellDates & numeric validation

Find the number of days in a month

PowerShell: DaysInMonth handles leap-year February correctly.

PowerShell✓ Tested
Linux CommandsDates & process utilities

Format a zero-padded numeric label

Linux Commands: Use printf formatting instead of concatenating a variable number of zeroes.

Linux Commands✓ Tested
Linux CommandsDates & process utilities

Generate a stepped sequence

Linux Commands: Use seq when a command pipeline needs a numeric sequence.

Linux Commands✓ Tested
HTMLGetting Started

Give a date a machine-readable value

HTML: Learn how to give a date a machine-readable value in a complete browser example.

HTML✓ Tested
Arduino / CSerial protocols

Handle incomplete serial input

Arduino / C: The returned byte count distinguishes a complete payload from a timed-out partial one.

Arduino / C✓ Tested