Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: How do I convert a hex date?

$
0
0

<!---

Assumption: 0x01cf2f8e|0x6e559e00 stands for the Hex number 1cf2f8e6e559e00. That is the number of ticks.

--->

<!--- Conversion of the number of ticks, 1cf2f8e6e559e00, from Hex to Base 10, remembering that F=15, E=14, D=13, C=12, etc  --->

<cfset numberOfTicks = 14*16^2+9*16^3+5*16^4+5*16^5+14*16^6+6*16^7+14*16^8+8*16^9+15*16^10+2*16^11+15*16^12+12*16^13+1*16^14>

 

<!---

By definition,

 

1 second = 10 000 000 ticks.

--->

<cfset numberOfWholeMinutes = round(numberOfTicks/(10000000*60))>

 

<!--- Starting datetime is 1st January 1600 --->

<cfset zeroDateTime=createdatetime(1600,1,1,0,0,0)>

 

<cfset newDateTime=dateadd("n",numberOfWholeMinutes,zeroDateTime)>

 

<cfoutput>#newDateTime#</cfoutput>

 

My answer is: 2013-02-21 05:25:00

 

 

[Sidenote: I attempted to use the function inputBaseN("1cf2f8e6e559e00",16) to convert from Hex to base 10, but it gave the wrong result! I will now report this as a bug. I would suggest that you write your own function to do the conversion.]


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>