Results for “datetime”
Small, practical examples. Search by task or narrow things down below.
Convert an aware datetime to another offset
Python: Use astimezone for conversion; replacing tzinfo alone does not convert an instant.
Python✓ Tested
Convert Unix time to a timestamp
Interpret a seconds-since-epoch value as UTC.
unixepoch✓ Tested
Parse and format a date
Convert a date string into a datetime object, then format it in a different, human-readable order.
date✓ Tested
Convert an instant to a regional timezone
Java: Use ZonedDateTime with a named zone to apply that zone’s offset rules.
Java✓ 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
Mark up a machine-readable date
Pair a readable date with an ISO datetime attribute in HTML.
HTML✓ Tested
Parse a date with an explicit input pattern
Java: Use DateTimeFormatter for a non-ISO date representation.
Java✓ Tested