2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ihc.internal.ws.datatypes;
15 import java.time.LocalDateTime;
16 import java.time.ZoneId;
17 import java.time.ZonedDateTime;
20 * Class for WSDate complex type.
22 * @author Pauli Anttila - Initial contribution
30 private int monthWithJanuaryAsOne;
35 public WSDate(int hours, int minutes, int seconds, int year, int day, int monthWithJanuaryAsOne) {
37 this.minutes = minutes;
38 this.seconds = seconds;
41 this.monthWithJanuaryAsOne = monthWithJanuaryAsOne;
45 * Gets the hours value for this WSDate.
49 public int getHours() {
54 * Sets the hours value for this WSDate.
58 public void setHours(int hours) {
63 * Gets the minutes value for this WSDate.
67 public int getMinutes() {
72 * Sets the minutes value for this WSDate.
76 public void setMinutes(int minutes) {
77 this.minutes = minutes;
81 * Gets the seconds value for this WSDate.
85 public int getSeconds() {
90 * Sets the seconds value for this WSDate.
94 public void setSeconds(int seconds) {
95 this.seconds = seconds;
99 * Gets the year value for this WSDate.
103 public int getYear() {
108 * Sets the year value for this WSDate.
112 public void setYear(int year) {
117 * Gets the day value for this WSDate.
121 public int getDay() {
126 * Sets the day value for this WSDate.
130 public void setDay(int day) {
135 * Gets the monthWithJanuaryAsOne value for this WSDate.
137 * @return monthWithJanuaryAsOne
139 public int getMonthWithJanuaryAsOne() {
140 return monthWithJanuaryAsOne;
144 * Sets the monthWithJanuaryAsOne value for this WSDate.
146 * @param monthWithJanuaryAsOne
148 public void setMonthWithJanuaryAsOne(int monthWithJanuaryAsOne) {
149 this.monthWithJanuaryAsOne = monthWithJanuaryAsOne;
153 * Gets WSDate as LocalDateTime.
155 * @return LocalDateTime
157 public LocalDateTime getAsLocalDateTime() {
158 return LocalDateTime.of(year, monthWithJanuaryAsOne, day, hours, minutes, seconds);
162 * Gets WSDate as ZonedDateTime.
164 * @return LocalDateTime
166 public ZonedDateTime getAsZonedDateTime(ZoneId zoneId) {
167 return ZonedDateTime.of(getAsLocalDateTime(), zoneId);