In retrieving the file list from FlashAir 2nd gen using their command cgi as explained here: FlashAir Get List CGI Command I get decimal 16-bit integers to represent the date and time of the file.
The specification (in the link posted) explains how to understand the retrieved values, but it lacks a Java example. I tried downloading and inspecting Android sample code posted in the FlashAir Developer's Website FlashAir Tutorial for Android - Downloading Content, but they just use the file names, so they do not perform any conversions.
Just extract the bits as specified.
Assuming you have a short time
and short date
:
int seconds = (time & 31) * 2;
int minutes = (time >> 5) & 63;
int hours = (time >> 11) & 31;
int day = date & 31;
int month = (date >> 5) & 15;
int year = ((data >> 9) & 127) + 1980;
Then just make a datetime out of that.
It's not clear whether the raw years can be negative. I wrote it such that they can't be, if they're supposed to be able to be negative (to represent dates before 1980) just remove the & 127
.