Results for “Dates & times”
Small, practical examples. Search by task or narrow things down below.
Convert a timestamp to a different fixed offset
C#: ToOffset changes the displayed local time while retaining the same instant.
C#✓ Tested
Convert a Unix timestamp to aware UTC
Python: Supply timezone.utc so the result does not depend on the machine time zone.
Python✓ Tested
Convert a Unix timestamp to UTC
Linux Commands: Use the @ syntax with GNU date for seconds since the Unix epoch.
Linux Commands✓ Tested
Convert Unix seconds into an aware UTC timestamp
PowerShell: DateTimeOffset.FromUnixTimeSeconds creates a value with an explicit UTC offset.
PowerShell✓ Tested
Convert Unix seconds to an offset-aware timestamp
C#: DateTimeOffset preserves the UTC offset explicitly.
C#✓ Tested
Format a known UTC timestamp
Linux Commands: Use GNU date -u and an explicit input offset to avoid local timezone dependence.
Linux Commands✓ Tested
Format a UTC timestamp
Format a UTC timestamp using a complete Go program with explicit sample inputs.
Go✓ Tested
Sort timestamp strings by their parsed instants
JavaScript: Compare epoch values explicitly when date strings may contain different offsets.
JavaScript✓ Tested
Sort timestamp strings by their parsed instants
TypeScript: Compare epoch values explicitly when date strings may contain different offsets.
TypeScript✓ Tested
Advance a calendar date
Advance a calendar date using a complete Go program with explicit sample inputs.
Go✓ Tested
Convert Unix seconds to UTC
Convert Unix seconds to UTC using a complete Go program with explicit sample inputs.
Go✓ Tested
Display an instant at a fixed offset
Display an instant at a fixed offset using a complete Go program with explicit sample inputs.
Go✓ Tested