Date and time in Hexa decimal

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 week, 2 days ago.

  • Author
    Posts
  • #66385
    Profile photo of Deepak Gopaluni
    Deepak Gopaluni
    Participant

    I have queried for installed hotfix information from a machine from windows client machine, im able to get all the information except the installed on file return with hexa decimal.
    I imported the output file in to the excel sheet and tried to format the installed on column with normal date and time however i was unable to do it if i change the format the value appears like this "############".

    Sample of output information from the get-hotfix information.
    Caption Description HotFixID InstalledBy InstalledOn
    http://support.microsoft.com/?kbid=2079403 Security Update KB2079403 S-1-5-21-1533859529-1408025176-2769211490-500 01ccdaac39926974 –> Date and time format.

    Note : As per the design "https://msdn.microsoft.com/en-us/library/aa394391(VS.85).aspx" from some operating systems it is expected to get hexadecimal value

    I have a powershell script which would gets me to open the excel sheet however im unable to write further commands to modify the installed on column to convert to date/time format from hexa decimal.

    Any help would be higly appreaciated.

    ###############################################
    Power shell script.
    $oldci = [System.Threading.Thread]::CurrentThread.CurrentCulture
    $newci = [System.Globalization.CultureInfo]"en-US"

    $path='E:\Case share\HSBC-Manish\date.xlsx'
    $objExcel = New-Object -ComObject "Excel.Application"
    $objExcel.visible = $true
    [system.threading.Thread]::CurrentThread.CurrentCulture = $newci
    $objWorkbook =$objExcel.Workbooks.Open($path)
    $worksheet = $objWorkbook.sheets.item("date")
    #############################################

  • #66474
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Is this just that the column is too narrow in Excel, and you need to widen the column when viewing the sheet?

  • #66478
    Profile photo of Don Jones
    Don Jones
    Keymaster

    And unfortunately, also per the docs, the only way I'm aware of to convert that is to use https://msdn.microsoft.com/en-us/library/ms724280(v=vs.85).aspx. However, unless you've got a REALLY REALLY OLD system, it shouldn't be using hex.

    Additionally... are you hell-bent on using Excel? If so, you might look at Doug Finke's PowerShell commands for writing to Excel. Personally, I'd put the data in a SQL Express database. It's about a ton easier. We've a free book on building trend and historical reports that has several examples, including how to get SQL to generate reports from the data.

You must be logged in to reply to this topic.