I have a problem with LocalDateTime.now()
returning the wrong time(off by 2 hours, the same as the timezone)
When I check the linux server the date
command returns the right time, running hwclock -r
shows the right time too.
This is from the command timedatectl
https://gyazo.com/9c70f5719a03492e0d7fdff3128f2f1d
The local time is what is shown in date
and hwclock -r
but LocalDateTime.now()
returns the universal time/RTC time
Even MySQL shows the local time (doing SELECT NOW()
)
Any ideas to why/what I have to change to make LocalDateTime.now()
return the correct time - I know I could use a ZonedTimeZone
but this is not only for my own projects but it also applies to other java programs/plugins running on the machine that I don't have control over