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