与Java.Time.localdate和Java.Time.LocalTime或Java.Time.LocaldateTime构建org.joda.time.time.datetime

发布于 2025-01-28 20:20:13 字数 147 浏览 4 评论 0 原文

因此,基本上我有一个datepicker和timepicker,分别将为我提供一个本地日期和本地时间。现在,我想使用这些值来制作org.joda.time.datetime变量。

我不确定该怎么做。我到处都看,但找不到我发现的所有答案的好答案,都是我不使用的JPA。

So basically I have a DatePicker and TimePicker which will respectively give me a LocalDate and LocalTime. Now I want to use these values to make a org.joda.time.DateTime variable.

I'm not sure how to do that. I looked everywhere but I can't find a good answer to this all the answers I've found were for JPA which I'm not using.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

后知后觉 2025-02-04 20:20:13

根据官方文档, https:///www.joda。 org/joda time/apidocs/org/joda/time/dateTime.html
您可以使用
dateTime(int年,int int oferof yrofmear,int dayofmonth,int hourofday,int suncerofhour,int secondofminute,int millisofsecond)
在默认时区中使用等级学从DateTime字段值构建实例。
构造函数的值可以从localdate和localtime对象获得

As per official documentation https://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html
you can use
DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Constructs an instance from datetime field values using ISOChronology in the default time zone.
The values for the constructor can be obtained from LocalDate and Localtime object
https://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文