FIND YOUR NEXT FEW LINES

Results for “Dates & precise numbers”

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

184 snippets foundClear filters
PowerShellDates & numeric validation

Find the number of days in a month

PowerShell: DaysInMonth handles leap-year February correctly.

PowerShell✓ Tested
GoDates & times

Find the weekday for a date

Find the weekday for a date using a complete Go program with explicit sample inputs.

Go✓ Tested
PowerShellDates & numeric validation

Format a bounded duration as hours minutes and seconds

PowerShell: TimeSpan can format duration components with escaped separators.

PowerShell✓ Tested
Linux CommandsDates & process utilities

Format a known UTC timestamp

Linux Commands: Use GNU date -u and an explicit input offset to avoid local timezone dependence.

Linux Commands✓ Tested
GoDates & times

Format a UTC timestamp

Format a UTC timestamp using a complete Go program with explicit sample inputs.

Go✓ 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
PythonNumbers & calculations

Insert a value while preserving sorted order

Python: Use insort on an already sorted list; insertion still shifts later list elements.

Python✓ Tested
JavaDates & time zones

Measure a duration between instants

Java: Use Duration for elapsed timeline time and retrieve total seconds.

Java✓ Tested
GoDates & times

Measure a duration between instants

Measure a duration between instants using a complete Go program with explicit sample inputs.

Go✓ Tested
GoDates & times

Parse a date with a Go layout

Parse a date with a Go layout using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaDates & time zones

Parse a date with an explicit input pattern

Java: Use DateTimeFormatter for a non-ISO date representation.

Java✓ Tested