Jump to content

Converting from decimal to hexadecimal


Recommended Posts

I have taken the form date/time string function and want to extract different components(day, month, year, minutes, hours). In doing so I want to convert each number to its hexadecimal form. 

In my case I have converted the number to a decimal(to eliminate/track any error in the conversion) and then used the type cast function to convert to hexadecimal. I want to know why when I have an input of 6 and then I get a hex value of 0000 0000 0000 0006. I simply just want the 06 value. What can I do to fix this? I want to eliminate having to extract the 06 into another substring. 

Link to comment

It appears that the decimal "6" is being provided as a 32 bit integer based on your description.  You'll need to convert it to an 8 bit integer before type casting. 

Without seeing your code, I made an assumption and created the example below, which returns the hex value "6" for the month of June:

image.png.4572773a53e776a46d93f509c0c648bc.png

Edited by Bryan
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.