Results for “time”
Small, practical examples. Search by task or narrow things down below.
Find the last day of a month
Java: Use YearMonth so leap years and month lengths are handled by the calendar library.
Java✓ Tested
Find the next chosen weekday
Java: TemporalAdjusters.next excludes the starting day even if it already has that weekday.
Java✓ Tested
Find the number of days in a month
Python: Use calendar.monthrange to account for leap years.
Python✓ Tested
Find the weekday for a date
Find the weekday for a date using a complete Go program with explicit sample inputs.
Go✓ Tested
Generate a half-open range of dates
Java: datesUntil includes the starting date and excludes the end date.
Java✓ Tested
Give a date a machine-readable value
HTML: Learn how to give a date a machine-readable value in a complete browser example.
HTML✓ Tested
Handle incomplete serial input
Arduino / C: The returned byte count distinguishes a complete payload from a timed-out partial one.
Arduino / C✓ Tested
Mark up a machine-readable date
Pair a readable date with an ISO datetime attribute in HTML.
HTML✓ Tested
Measure a duration between instants
Java: Use Duration for elapsed timeline time and retrieve total seconds.
Java✓ Tested
Measure a duration between instants
Measure a duration between instants using a complete Go program with explicit sample inputs.
Go✓ Tested
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
Parse a date with an explicit input pattern
Java: Use DateTimeFormatter for a non-ISO date representation.
Java✓ Tested