LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-17-2013, 02:21 AM   #1
ohcarol
Member
 
Registered: Dec 2004
Location: Nepal
Posts: 86

Rep: Reputation: 15
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
 
Old 04-17-2013, 02:43 AM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
are those hexes in strings or pure binary value? at least us how it is currently stored.
 
Old 04-17-2013, 04:35 AM   #3
ohcarol
Member
 
Registered: Dec 2004
Location: Nepal
Posts: 86

Original Poster
Rep: Reputation: 15
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
 
Old 04-17-2013, 06:20 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,352

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert windows date and time to unix date and time jitupatil_2007 General 8 03-31-2008 05:58 AM
Convert Normal Date to Unix Time gbratig AIX 5 06-02-2007 03:46 PM
convert date time format given in string suchi_s Programming 6 01-10-2005 04:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration