I am trying to duplicate the functionality that is currently implemented in VB. What I need to do is convert a date to a long integer and then convert that to a string. I also need to convert a long integer into a HEX value of that integer and then that to a string.
Here is the code I am using in VB.
If dteCreated <> #12:00:00 AM# Then
strHash = CStr(CLng(dteCreated))
If InStr(1, strHash, ".", vbTextCompare) > 0 Then
strHash = Left(strHash, InStr(1, strHash, ".", 1) - 1) & "_" & Mid(strHash, InStr(1, strHash, ".", 1) + 1)
Else
strHash = strHash & "_00000"
End If
strHash = strHash & "_" & CStr(Hex(intereq))
The two variables are dteCreated (Date) and intereq (Long). What this builds is a hashed query string that is decoded on our server.
Can anyone help with the methods I would need to use in Objective-C to get this same functionality?
You can use a reference since 1970 to convert to a NSTimeInterval which is a double, use:
You can convert the double to an int and back with casting loosing only the fractions of a second.
Example:
NSLog output: