Class: Toybox.System.ClockTime

Inherits:
Toybox.Lang.Object show all

Overview

Represents the current local time.

ClockTime is a convenient way to get the current time in an easy-to-use format without the need to perform time zone conversions or time-based arithmetic. Values provided by ClockTime may require formatting for proper display within an app.

See Also:

Example:

Get the time and print it to the console

using Toybox.System;
var myTime = System.getClockTime(); // ClockTime object
System.println(
    myTime.hour.format("%02d") + ":" +
    myTime.min.format("%02d") + ":" +
    myTime.sec.format("%02d")
);

Since:

API Level 1.0.0

Instance Member Summary collapse

Instance Attribute Details

var dst as Lang.Number

The daylight savings time offset.

Since:

API Level 1.0.0

Returns:

var hour as Lang.Number

The hour of the day based on a 24-hour clock.

Since:

API Level 1.0.0

Returns:

var min as Lang.Number

The minute of the current hour.

Since:

API Level 1.0.0

Returns:

var sec as Lang.Number

The second of the current minute.

Since:

API Level 1.0.0

Returns:

var timeZoneOffset as Lang.Number

The time offset from UTC in seconds.

Since:

API Level 1.0.0

Returns:


Generated Dec 11, 2024, 8:58:43 AM