LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to convert PHP hex date and time (https://www.linuxquestions.org/questions/programming-9/how-to-convert-php-hex-date-and-time-4175458423/)

ohcarol 04-17-2013 02:21 AM

how to convert PHP hex date and time
 
Hello all,

While querying my switch with snmp I got hex value of date and time "07 DD 04 10 09 32 37 02 " which is equal to "

07 DD = 2013 (Year)
04 = 4 (month)
10 = 10 (day)
09 = 9 (hour)
32 = 50 (min)
37 = 55 (sec)
02 = 2

How can I convert hex date and time with php scripts?


thank you

konsolebox 04-17-2013 02:43 AM

are those hexes in strings or pure binary value? at least us how it is currently stored.

ohcarol 04-17-2013 04:35 AM

Those are hex value. Below is the actual output from snmpwalk:

SNMPv2-SMI::enterprises.2011.6.128.1.1.2.57.1.23.4227860224.2 = Hex-STRING: 07 DD 04 10 09 32 37 02

chrism01 04-17-2013 06:20 AM

See hexdec() fn http://php.net/manual/en/function.hexdec.php


All times are GMT -5. The time now is 08:15 PM.