Results for “Dates & time zones”
Small, practical examples. Search by task or narrow things down below.
Consume positional arguments one at a time
Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.
Bash Scripts✓ Tested
Count days between calendar dates
PowerShell: Parse an unambiguous format before subtracting date values.
PowerShell✓ Tested
Count days between UTC-midnight dates
JavaScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.
JavaScript✓ Tested
Count days between UTC-midnight dates
TypeScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.
TypeScript✓ Tested
Create a runtime file during the build
Docker / Compose: RUN executes during the build while CMD executes when a container starts.
Docker / Compose✓ Tested
Create a small file at build time
Docker / Compose: Create a small file at build time with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Debounce a button with a stable-time check
Accept an input change only after it stays stable for 30 ms.
debounce✓ Tested
Format a date in an explicit timezone
Format a date in an explicit timezone with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Format a known timestamp in UTC
C: gmtime converts to UTC calendar fields and strftime formats them.
C✓ Tested
Handle a request timeout
jQuery: The timeout option bounds how long the client waits.
jQuery✓ Tested
Keep scratch data only for the container lifetime
Docker / Compose: Separate tmpfs mounts do not share data between container runs.
Docker / Compose✓ Tested
Observe shared ownership without extending its lifetime
C++: A weak_ptr can be locked while an owner exists and becomes expired after the last owner is released.
C++✓ Tested