DateTime
classin packageklyn.time
public class DateTime extends Object implements ValueType:
Represents a date and time, including timezone information.
This class provides methods to create and manipulate date/time values.
It supports initialization from a timestamp or from individual date/time
components.
import klyn.time
dt = DateTime(year=2023, month=10, day=5, hour=14, minute=30, second=45)
print(dt.toString()) # 2023-10-05 14:30:45
@since 1.0
Properties
| Modifier and Type |
Member |
Description |
| public readonly property |
day |
Day component. |
| public readonly property |
hour |
Hour component. |
| public readonly property |
minute |
Minute component. |
| public readonly property |
month |
Month component (1. |
| public static readonly property |
now |
Returns the current date and time. |
| public readonly property |
second |
Second component. |
| public readonly property |
timeZone |
Timezone of this date/time. |
| public readonly property |
timestamp |
Returns the timestamp representation of this DateTime object. |
| public readonly property |
totalSeconds |
No summary. |
| public readonly property |
usecond |
Microsecond component. |
| public readonly property |
year |
Year component. |
Constructors
| Modifier and Type |
Member |
Description |
| public |
DateTime |
Constructs a DateTime from a timestamp. |
| public |
DateTime |
Constructs a DateTime from individual date/time components. |
Methods
| Modifier and Type |
Member |
Description |
| public static |
fromTimestamp |
Constructs a DateTime object from a timestamp. |
| public override |
toString |
Returns a string representation of this DateTime object. |
Operators