推荐 最新
MastFancy

如何将java中的LocalDateTime类型和mysql中的datetime类型相对应?

如何将java中的LocalDateTime类型和mysql中的datetime类型相对应?我查了一下,貌似需要先将LocalDateTime转成TimeStamp,为什么不是用Date类型,因为很多方法已经弃用,而且线程不安全。或者说有没有更好的处理日期时间的方法呢? 我想知道具体如何将mysql中的datetime类型和java的数据类型相对应起来

0
1
0
浏览量208
PunkMaccccc

PHP strtotime函数与时区问题?

我在使用PHP strtotime函数是,遇到了+9时区的问题。 $first_day = strtotime($year.'-'.$i.'-01 00:00:00'); return json($first_day); 得到的结果是 2024-01-01 09:00:00 请问到底该怎么解决才能使 strtotime 直接得到0点的时间戳? 我检查了系统的时区,timedatectl 返回的结果 Local time: Wed 2024-01-03 22:15:09 CST Universal time: Wed 2024-01-03 14:15:09 UTC RTC time: Wed 2024-01-03 14:15:09 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes NTP service: active RTC in local TZ: no PHP date_default_timezone_get() 返回的是PRC。 即便使用 DateTime 得到的依然是2024-01-01 09:00:00。 new DateTime($year.'-'.$i.'-01', new DateTimeZone('Asia/Shanghai'));

0
1
0
浏览量20