FIND YOUR NEXT FEW LINES

Results for “time”

Small, practical examples. Search by task or narrow things down below.

236 snippets foundClear filters
AngularLifecycle & observable data

Tie a subscription’s lifetime to its component

Tie a subscription’s lifetime to its component with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
GoDates & times

Advance a calendar date

Advance a calendar date using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonDates & time zones

Advance a date by a number of days

Python: Use timedelta so month and year boundaries are handled automatically.

Python✓ Tested
JavaDates & time zones

Check the Gregorian leap-year rule

Java: Use Year.isLeap rather than checking divisibility by four alone.

Java✓ Tested
RustNumbers & durations

Construct an instant relative to the Unix epoch

Construct an instant relative to the Unix epoch in a complete Rust program using the standard library.

Rust✓ Tested
PythonDates & time zones

Convert a duration to hours and minutes

Python: Use divmod to split nonnegative whole seconds into display components.

Python✓ Tested
JavaDates & time zones

Convert epoch seconds into an instant

Java: Instant represents a UTC timeline point independent of the default timezone.

Java✓ Tested
GoDates & times

Convert Unix seconds to UTC

Convert Unix seconds to UTC using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonDates & time zones

Count days between calendar dates

Python: Subtract date objects to get an exact calendar-day difference.

Python✓ Tested
JavaDates & time zones

Count days between two dates

Java: Use ChronoUnit.DAYS for an elapsed count rather than a Period day component.

Java✓ Tested
PythonDates & time zones

Determine whether a year is a leap year

Python: Use calendar.isleap rather than a simplified divisibility-by-four check.

Python✓ Tested
GoDates & times

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