{"id":338,"date":"2011-12-02T00:36:15","date_gmt":"2011-12-02T00:36:15","guid":{"rendered":"http:\/\/shivdev.com\/blog\/?p=338"},"modified":"2011-12-02T00:41:54","modified_gmt":"2011-12-02T00:41:54","slug":"mysql-converting-mac-address-to-a-number","status":"publish","type":"post","link":"http:\/\/shivdev.com\/blog\/2011\/12\/02\/mysql-converting-mac-address-to-a-number\/","title":{"rendered":"MySQL converting MAC Address to a Number"},"content":{"rendered":"<p>Here&#8217;s an example of converting a Mac Address <em><strong>01:23:45:67:89:ab<\/strong><\/em> into a decimal number (1250999896491), using the MySQL <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/mathematical-functions.html#function_conv\">conv()<\/a> function. <\/p>\n<p>The idea is <strong>select CONV(&#8216;0123456789ab&#8217;, 16, 10);<\/strong> &#8212;<em> 01:23:45:67:89:ab<\/em> without the :<\/p>\n<blockquote><p>\nselect <strong>CONV(REPLACE(SUBSTR(&#8217;01:23:45:67:89:ab&#8217;, INSTR(&#8217;01:23:45:67:89:ab&#8217;, &#8216;(&#8216;)+1, 17),&#8217;:&#8217;,&#8221;),16,10);<\/strong><\/p>\n<p>Results In: 1250999896491\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s an example of converting a Mac Address 01:23:45:67:89:ab into a decimal number (1250999896491), using the MySQL conv() function. The idea is select CONV(&#8216;0123456789ab&#8217;, 16, 10); &#8212; 01:23:45:67:89:ab without the : select CONV(REPLACE(SUBSTR(&#8217;01:23:45:67:89:ab&#8217;, INSTR(&#8217;01:23:45:67:89:ab&#8217;, &#8216;(&#8216;)+1, 17),&#8217;:&#8217;,&#8221;),16,10); Results In: 1250999896491<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/338"}],"collection":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":10,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":348,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/338\/revisions\/348"}],"wp:attachment":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}