Results for “UTC date operations”
Small, practical examples. Search by task or narrow things down below.
Read a filename stem and extension
C#: Use Path helpers instead of splitting a path on dots or directory separators.
C#✓ Tested
Read an ISO week number
Python: Use isocalendar because ISO week years can differ from calendar years near January.
Python✓ Tested
Read an ISO week year and week number
Java: Use ISO week fields together because a week can belong to the previous calendar year.
Java✓ Tested
Read an optional associative-array entry
Bash Scripts: Use a fallback expansion when a map key may not be present under nounset.
Bash Scripts✓ Tested
Read compressed text directly
Python: Open gzip data in text mode with an explicit encoding.
Python✓ Tested
Read the byte size of a regular file
C++: file_size reads filesystem metadata without loading file contents.
C++✓ Tested
Read the last array element
PowerShell: A negative array index counts backward from the end.
PowerShell✓ Tested
Reject infinity and NaN
C#: Double.IsFinite distinguishes usable finite numeric inputs from special values.
C#✓ Tested
Reject NaN and infinite values
PowerShell: Double.IsFinite excludes numeric values unsuitable for ordinary bounded calculations.
PowerShell✓ Tested
Remove an indexed element and compact the array
Bash Scripts: Unsetting an element leaves a gap; reassigning the values creates consecutive indices.
Bash Scripts✓ Tested
Remove collection items that satisfy a condition
Java: Use removeIf on a mutable collection to avoid changing it manually inside a for-each loop.
Java✓ Tested
Remove duplicate values while keeping the smallest key
SQL: Identify retained keys in a grouped subquery before deleting other copies.
SQL✓ Tested