FIND YOUR NEXT FEW LINES

Results for “UTC date operations”

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

395 snippets foundClear filters
PowerShellDates & numeric validation

Clamp a number to inclusive bounds

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

PowerShell✓ Tested
PythonFile operations & archives

Clean up a temporary directory automatically

Python: Use TemporaryDirectory as a context manager so cleanup also happens after exceptions.

Python✓ Tested
SQLBulk changes & set operations

Combine results while retaining duplicates

SQL: UNION ALL does not spend work removing equal rows.

SQL✓ Tested
SQL ServerBulk changes & set operations

Combine results while retaining duplicates

SQL Server: UNION ALL does not spend work removing equal rows.

SQL Server✓ Tested
PostgresBulk changes & set operations

Combine results while retaining duplicates

Postgres: UNION ALL does not spend work removing equal rows.

Postgres✓ Tested
SQLiteBulk changes & set operations

Combine results while retaining duplicates

SQLite: UNION ALL does not spend work removing equal rows.

SQLite✓ Tested
CSmall algorithms & bit operations

Compute a simple XOR checksum

C: XOR all payload bytes into one byte to demonstrate a basic error-detection field.

C✓ 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
JavaDates & time zones

Convert an instant to a regional timezone

Java: Use ZonedDateTime with a named zone to apply that zone’s offset rules.

Java✓ Tested
PythonFile operations & archives

Copy a file and preserve its metadata

Python: Use copy2 for a file copy that also attempts to preserve timestamps and permission bits.

Python✓ Tested