FIND YOUR NEXT FEW LINES

Results for “date difference”

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

275 snippets foundClear filters
Linux CommandsDates & process utilities

Bound a command execution time

Linux Commands: Use timeout and handle status 124 as an expected time limit.

Linux Commands✓ Tested
C#Dates & precise numbers

Calculate an integer beyond the 64-bit range

C#: Use BigInteger for arbitrary-precision integer arithmetic.

C#✓ Tested
C++Sequence algorithms

Calculate changes between successive readings

C++: adjacent_difference keeps the first value and then writes each difference from its predecessor.

C++✓ Tested
JavaDates & time zones

Check the Gregorian leap-year rule

Java: Use Year.isLeap rather than checking divisibility by four alone.

Java✓ Tested
SQLiteJSON data

Check whether text is valid JSON

Reject malformed input before processing it.

json_valid✓ Tested
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
PostgresWindows & text

Compare a row with the previous row

Read a preceding value with LAG.

LAG✓ 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
PythonDates & time zones

Convert a duration to hours and minutes

Python: Use divmod to split nonnegative whole seconds into display components.

Python✓ Tested
C#Dates & precise numbers

Convert a timestamp to a different fixed offset

C#: ToOffset changes the displayed local time while retaining the same instant.

C#✓ Tested
PythonDates & time zones

Convert a Unix timestamp to aware UTC

Python: Supply timezone.utc so the result does not depend on the machine time zone.

Python✓ Tested