Android Question How do I convert DateTime.now to HEX?

LucaMs

Expert
Licensed User
Longtime User
B4X:
Dim BC As ByteConverter
Dim hexNow As String
hexNow = BC.HexFromBytes(BC.LongsToBytes(Array As Long(DateTime.Now)))
Log(hexNow)

Requires the ByteConverter library




P.S.
"Better" code:
B4X:
Dim HexNow As String
HexNow = HexStrFromLong(DateTime.Now)
Log("Now hex: " & HexNow)


'Requires the ByteConverter library
Public Sub HexStrFromLong(Value As Long) As String
   Dim BC As ByteConverter
   Return BC.HexFromBytes(BC.LongsToBytes(Array As Long(Value)))
End Sub
 
Last edited:
Upvote 0
Top