# There's an old Southern expression: going around your ass to get to your elbow

**URL:** <https://boards.straightdope.com/t/theres-an-old-southern-expression-going-around-your-ass-to-get-to-your-elbow/278401>\
**Category:** Miscellaneous and Personal Stuff I Must Share\
**Created:** [December 6, 2004, 7:26pm UTC](https://boards.straightdope.com/t/theres-an-old-southern-expression-going-around-your-ass-to-get-to-your-elbow/278401 "2004-12-06T19:26:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [December 6, 2004, 7:26pm UTC](https://boards.straightdope.com/t/theres-an-old-southern-expression-going-around-your-ass-to-get-to-your-elbow/278401/1 "2004-12-06T19:26:43Z")

</div>

**Found on an ASP message board**

A routine for converting hex to decimal in VBScript:

```auto

Function Hex2Dec(HexString)
Dim Dvalue
Dim q,a,p

If Ucase(Left(HexString,2))="&H" or Ucase(Left(HexString,2))="0X" then
q = mid(HexString,3)
Dvalue=0

While q <> ""
a=left(q,1)
q=mid(q,2)
select case a
case "0"
p=0
case "1"
p=1
case "2"
p=2
case "3"
p=3
case "4"
p=4
case "5"
p=5
case "6"
p=6
case "7"
p=7
case "8"
p=8
case "9"
p=9
case "A","a"
p=10
case "B","b"
p=11
case "C","c"
p=12
case "D","d"
p=13
case "E","e"
p=14
case "F","f"
p=15
case else
p=0
end select
Dvalue=Dvalue+p*16^len(q)

Wend
end if

Hex2Dec = Dvalue

End Function

```

**Meanwhile, back at the elbow…**

Um, yeah. You could also try:

CInt("&H" & HexValue)

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [December 6, 2004, 8:37pm UTC](https://boards.straightdope.com/t/theres-an-old-southern-expression-going-around-your-ass-to-get-to-your-elbow/278401/2 "2004-12-06T20:37:44Z")

</div>

Writing your own base converter can be a valuable educational experience, but not if you do it like that.

---

<div class="post-metadata">

**Author:** ![Left\_Hand\_of\_Dorkness](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/left_hand_of_dorkness/32/7156_2.png) [@Left\_Hand\_of\_Dorkness](https://boards.straightdope.com/u/Left_Hand_of_Dorkness)\
**Post date:** [December 6, 2004, 8:40pm UTC](https://boards.straightdope.com/t/theres-an-old-southern-expression-going-around-your-ass-to-get-to-your-elbow/278401/3 "2004-12-06T20:40:48Z")

</div>

Heh. I can’t laugh too hard, because I’ve done the same sort of back-ass stuff in my own coding, when I didn’t have any training and didn’t have the resources to make a more elegant solution.

Worst was when I was coding for the animal shelter, some report telling which animals required review of their veterinary records that day. The database contained a first treatment date and a number of days the treatment should last but no review date.

A simple function would be something like

**Select \* (Where Day([TreatmentDate])+ [Number\_Days]-1)=Day([Today])**

This would work for treatments on December 5 that lasted for 7 days, selecting that record on December 11 for review. But treatments beginning on November 29 and lasting for 7 days would only be selected on November 35–not an acceptable solution.

So I ended up plugging in the whole “Thirty days hath September” business, accounting for leap years for Februaries, in an if-then statement that was referenced whenever today’s date minus the number of treatment days was less than 1. It was a nightmare.

About a year later – two or three weeks ago, actually–I found out about the “SerialDate” function, which converts a date to a string of numbers, making that whole thing unnecessary.

:smack:  
Daniel
