I'm having a problem with the date on a raspberry p3 device.
To extract the date and time I use the following code:
The result I get is a date that is exactly one hour less than the actual date.
I'm sure the system date on the device is correct because I checked it with the date command.
The strangest thing is that I've tried the code on 5 different raspberry devices.
On 4 I get the correct date and on the fifth the date is an hour back.
This although checking the date with the date command by console, the date is correct on all 5 devices.
What could be the problem?
Thanks.
To extract the date and time I use the following code:
B4X:
Public Sub estrai_data_ora_attuale As String
Dim date_format As String = DateTime.DateFormat
Dim time_format As String = DateTime.TimeFormat
DateTime.DateFormat = "yyyy-MM-dd" '"dd/MM/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
Dim data_ora As String = DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now)
DateTime.TimeFormat = time_format
DateTime.DateFormat = date_format
Return data_ora
End Sub
The result I get is a date that is exactly one hour less than the actual date.
I'm sure the system date on the device is correct because I checked it with the date command.
The strangest thing is that I've tried the code on 5 different raspberry devices.
On 4 I get the correct date and on the fifth the date is an hour back.
This although checking the date with the date command by console, the date is correct on all 5 devices.
What could be the problem?
Thanks.