Results for “Dates & times”
Small, practical examples. Search by task or narrow things down below.
Add calendar days
Use DateOnly for a date without a time zone in C#.
C#✓ Tested
Add days to a date
Parse an ISO date and add calendar days using Java LocalDate.
Java✓ Tested
Add days to a date
Use DATEADD for date arithmetic.
DATEADD✓ Tested
Add days to a date
Use a date modifier for calendar arithmetic.
date✓ Tested
Commit multiple related changes together
SQL: The first transaction prepares the fixtures. The second commits both updates as one unit.
SQL✓ Tested
Commit multiple related changes together
SQL Server: The first transaction prepares the fixtures. The second commits both updates as one unit.
SQL Server✓ Tested
Commit multiple related changes together
Postgres: The first transaction prepares the fixtures. The second commits both updates as one unit.
Postgres✓ Tested
Commit multiple related changes together
SQLite: The first transaction prepares the fixtures. The second commits both updates as one unit.
SQLite✓ Tested
Compare elapsed time across timer rollover
Use unsigned subtraction when a millisecond counter wraps.
rollover✓ Tested
Copy a file and preserve its metadata
Python: Use copy2 for a file copy that also attempts to preserve timestamps and permission bits.
Python✓ Tested
Count five LED flashes with a for loop
Arduino / C: Repeat an LED action a known number of times and print the current count.
Arduino / C✓ Tested
Create an empty file
Linux Commands: Use touch to create a file when absent; an existing file keeps its contents but gets updated timestamps.
Linux Commands✓ Tested