クラス
java.time.LocalDateTimeの使用
| パッケージ | 説明 |
|---|---|
| java.sql |
Java™プログラミング言語を使用してデータソース(通常はリレーショナル・データベース)に格納されたデータにアクセスして処理するためのAPIを提供します。
|
| java.time |
日付、時間、インスタント、デュレーションのメインAPI。
|
| java.time.chrono |
デフォルトのISO暦以外の暦体系の汎用API。
|
| java.time.zone |
タイムゾーンおよびそのルールのサポート。
|
| java.util.zip |
標準のZIPおよびGZIPファイル形式の読み込みおよび書込み用クラスを提供します。
|
-
java.sqlでのLocalDateTimeの使用
LocalDateTimeを返すjava.sqlのメソッド 修飾子と型 メソッド 説明 LocalDateTimeTimestamp. toLocalDateTime()このTimestampオブジェクトをLocalDateTimeに変換します。LocalDateTime型のパラメータを持つjava.sqlのメソッド 修飾子と型 メソッド 説明 static TimestampTimestamp. valueOf(LocalDateTime dateTime)指定されたLocalDateTimeと同じ年、月、「月の日」、時、分、秒、およびナノ秒の日付/時間値を持つTimestampのインスタンスをLocalDateTimeオブジェクトから取得します。 -
java.timeでのLocalDateTimeの使用
LocalDateTimeとして宣言されているjava.timeのフィールド 修飾子と型 フィールド 説明 static LocalDateTimeLocalDateTime. MAXサポートされている最大のLocalDateTimeである「+999999999-12-31T23:59:59.999999999」。static LocalDateTimeLocalDateTime. MINサポートされている最小のLocalDateTimeである「-999999999-01-01T00:00:00」。LocalDateTimeを返すjava.timeのメソッド 修飾子と型 メソッド 説明 LocalDateTimeLocalTime. atDate(LocalDate date)この時間を日付と組み合せてLocalDateTimeを作成します。LocalDateTimeLocalDate. atStartOfDay()この日付を深夜零時と組み合せて、この日付の開始時のLocalDateTimeを作成します。LocalDateTimeLocalDate. atTime(int hour, int minute)この日付を時間と組み合せてLocalDateTimeを作成します。LocalDateTimeLocalDate. atTime(int hour, int minute, int second)この日付を時間と組み合せてLocalDateTimeを作成します。LocalDateTimeLocalDate. atTime(int hour, int minute, int second, int nanoOfSecond)この日付を時間と組み合せてLocalDateTimeを作成します。LocalDateTimeLocalDate. atTime(LocalTime time)この日付を時間と組み合せてLocalDateTimeを作成します。static LocalDateTimeLocalDateTime. from(TemporalAccessor temporal)時間的オブジェクトからLocalDateTimeのインスタンスを取得します。LocalDateTimeLocalDateTime. minus(long amountToSubtract, TemporalUnit unit)指定された量を減算した、この日付/時間のコピーを返します。LocalDateTimeLocalDateTime. minus(TemporalAmount amountToSubtract)指定された量を減算した、この日付/時間のコピーを返します。LocalDateTimeLocalDateTime. minusDays(long days)指定された日数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusHours(long hours)指定された時間数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusMinutes(long minutes)指定された分数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusMonths(long months)指定された月数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusNanos(long nanos)指定されたナノ秒数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusSeconds(long seconds)指定された秒数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusWeeks(long weeks)指定された週数を減算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. minusYears(long years)指定された年数を減算して、このLocalDateTimeのコピーを返します。static LocalDateTimeLocalDateTime. now()デフォルトのタイムゾーンのシステム・クロックから現在の日付/時間を取得します。static LocalDateTimeLocalDateTime. now(Clock clock)指定されたクロックから現在の日付/時間を取得します。static LocalDateTimeLocalDateTime. now(ZoneId zone)指定されたタイムゾーンのシステム・クロックから現在の日付/時間を取得します。static LocalDateTimeLocalDateTime. of(int year, int month, int dayOfMonth, int hour, int minute)秒およびナノ秒をゼロに設定して、年、月、日、時、および分からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(int year, int month, int dayOfMonth, int hour, int minute, int second)ナノ秒をゼロに設定して、年、月、日、時、分、および秒からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond)年、月、日、時、分、秒、およびナノ秒からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(int year, Month month, int dayOfMonth, int hour, int minute)秒およびナノ秒をゼロに設定して、年、月、日、時、および分からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(int year, Month month, int dayOfMonth, int hour, int minute, int second)ナノ秒をゼロに設定して、年、月、日、時、分、および秒からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(int year, Month month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond)年、月、日、時、分、秒、およびナノ秒からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. of(LocalDate date, LocalTime time)日付と時間からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)エポック(1970-01-01T00:00:00Z)からの秒数を使用して、LocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. ofInstant(Instant instant, ZoneId zone)InstantおよびゾーンIDからLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. parse(CharSequence text)2007-12-03T10:15:30などのテキスト文字列からLocalDateTimeのインスタンスを取得します。static LocalDateTimeLocalDateTime. parse(CharSequence text, DateTimeFormatter formatter)特定のフォーマッタを使用して、テキスト文字列からLocalDateTimeのインスタンスを取得します。LocalDateTimeLocalDateTime. plus(long amountToAdd, TemporalUnit unit)この日時のコピーに指定された時間を追加したものを返します。LocalDateTimeLocalDateTime. plus(TemporalAmount amountToAdd)この日時のコピーに指定された時間を追加したものを返します。LocalDateTimeLocalDateTime. plusDays(long days)指定された日数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusHours(long hours)指定された時間数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusMinutes(long minutes)指定された分数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusMonths(long months)指定された月数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusNanos(long nanos)指定されたナノ秒数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusSeconds(long seconds)指定された秒数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusWeeks(long weeks)指定された週数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. plusYears(long years)指定された年数を加算して、このLocalDateTimeのコピーを返します。LocalDateTimeOffsetDateTime. toLocalDateTime()この日付/時間のLocalDateTime部分を取得します。LocalDateTimeZonedDateTime. toLocalDateTime()この日付/時間のLocalDateTime部分を取得します。LocalDateTimeLocalDateTime. truncatedTo(TemporalUnit unit)時間が切り捨てられた、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. with(TemporalAdjuster adjuster)この日付/時間の調整済のコピーを返します。LocalDateTimeLocalDateTime. with(TemporalField field, long newValue)指定されたフィールドを新しい値に設定して、この日付/時間のコピーを返します。LocalDateTimeLocalDateTime. withDayOfMonth(int dayOfMonth)「月の日」を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withDayOfYear(int dayOfYear)「年の日」を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withHour(int hour)時の値を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withMinute(int minute)分の値を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withMonth(int month)月を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withNano(int nanoOfSecond)ナノ秒の値を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withSecond(int second)秒の値を変更して、このLocalDateTimeのコピーを返します。LocalDateTimeLocalDateTime. withYear(int year)年を変更して、このLocalDateTimeのコピーを返します。LocalDateTime型のパラメータを持つjava.timeのメソッド 修飾子と型 メソッド 説明 static OffsetDateTimeOffsetDateTime. of(LocalDateTime dateTime, ZoneOffset offset)日付/時間およびオフセットからOffsetDateTimeのインスタンスを取得します。static ZonedDateTimeZonedDateTime. of(LocalDateTime localDateTime, ZoneId zone)ローカル日付/時間からZonedDateTimeのインスタンスを取得します。static ZonedDateTimeZonedDateTime. ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone)ローカル日付/時間とオフセットを組み合せることで形成されるインスタントからZonedDateTimeのインスタンスを取得します。static ZonedDateTimeZonedDateTime. ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset)可能であれば優先オフセットを使用して、ローカル日付/時間からZonedDateTimeのインスタンスを取得します。static ZonedDateTimeZonedDateTime. ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone)ローカル日付/時間、オフセット、およびゾーンIDの組合せを厳密に検証して、ZonedDateTimeのインスタンスを取得します。 -
java.time.chronoでのLocalDateTimeの使用
LocalDateTimeを返すjava.time.chronoのメソッド 修飾子と型 メソッド 説明 LocalDateTimeIsoChronology. localDateTime(TemporalAccessor temporal)別の日付/時間オブジェクトからISO暦のローカル日付/時間を取得します。 -
java.time.zoneでのLocalDateTimeの使用
LocalDateTimeを返すjava.time.zoneのメソッド 修飾子と型 メソッド 説明 LocalDateTimeZoneOffsetTransitionRule.TimeDefinition. createDateTime(LocalDateTime dateTime, ZoneOffset standardOffset, ZoneOffset wallOffset)指定されたローカル日付/時間を、実際に壁掛け時計に見られるようなローカル日付/時間に変換します。LocalDateTimeZoneOffsetTransition. getDateTimeAfter()後オフセットで表現されるような、ローカル遷移日付/時間を取得します。LocalDateTimeZoneOffsetTransition. getDateTimeBefore()前オフセットで表現されるような、ローカル遷移日付/時間を取得します。LocalDateTime型のパラメータを持つjava.time.zoneのメソッド 修飾子と型 メソッド 説明 LocalDateTimeZoneOffsetTransitionRule.TimeDefinition. createDateTime(LocalDateTime dateTime, ZoneOffset standardOffset, ZoneOffset wallOffset)指定されたローカル日付/時間を、実際に壁掛け時計に見られるようなローカル日付/時間に変換します。ZoneOffsetZoneRules. getOffset(LocalDateTime localDateTime)これらのルールで、指定されたローカル日付/時間に適したオフセットを取得します。ZoneOffsetTransitionZoneRules. getTransition(LocalDateTime localDateTime)これらのルールで、指定されたローカル日付/時間に適用できるオフセット遷移を取得します。List<ZoneOffset>ZoneRules. getValidOffsets(LocalDateTime localDateTime)これらのルールで指定されたローカル日付/時間に適用できるオフセットを取得します。booleanZoneRules. isValidOffset(LocalDateTime localDateTime, ZoneOffset offset)オフセット日付/時間がこれらのルールに対して有効であるかどうかを確認します。static ZoneOffsetTransitionZoneOffsetTransition. of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter)2つのオフセット間の遷移を定義するインスタンスを取得します。 -
java.util.zipでのLocalDateTimeの使用
LocalDateTimeを戻すjava.util.zipのメソッド 修飾子と型 メソッド 説明 LocalDateTimeZipEntry. getTimeLocal()ローカル日時のエントリの最終更新時間を返します。型LocalDateTimeのパラメータを持つjava.util.zipのメソッド 修飾子と型 メソッド 説明 voidZipEntry. setTimeLocal(LocalDateTime time)エントリの最終更新時間をローカルの日時に設定します。