Jump to content

Search the Community

Showing results for tags 'time conversion'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I have an Excel file that I want to read and display the dates and times from each row, but the time value is a small decimal number. I want to convert that number to an actual time string. The Excel data is: Col A Col B Col C 6/17/2016 1:00:00 Date is 6/17/2015, time is 1:00:00 AM 6/17/2016 1:00:01 Date is 6/17/2015, time is 1:00:01 AM 6/17/2016 2:00:00 Date is 6/17/2015, time is 2:00:00 AM 6/17/2016 3:00:00 Date is 6/17/2015, time is 3:00:00 AM My test code is: #include <Excel.au3> #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=THTracker.ico #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_UseX64=N #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** test() Func test() Local $fn, $ffn, $obj, $ndx, $ndx2, $ar $fn = "C:\Util\AutoIT-src\myStuff\THTracker\Copy of 2016 Easton 100.xlsx" ConsoleWrite("+++: $fn ==>" & $fn & "<==" & @CRLF) $ffn = FileGetShortName($fn, 1) ConsoleWrite("+++: $ffn ==>" & $ffn & "<==" & @CRLF) $obj = _ExcelBookOpen($ffn, 0, 1) ; open excel in the background ConsoleWrite("+++: isObj($obj) = " & IsObj($obj) & @CRLF) $ar = _ExcelReadSheetToArray($obj) _ExcelBookClose($obj) ConsoleWrite("+++: $ar[0][0] = " & $ar[0][0] & @CRLF) ConsoleWrite("+++: $ar[0][1] = " & $ar[0][1] & @CRLF) For $ndx = 1 To $ar[0][0] ConsoleWrite("+++: Date = " & $ar[$ndx][1] & @CRLF) ConsoleWrite("+++: Time = " & $ar[$ndx][2] & @CRLF) For $ndx2 = 1 To $ar[0][1] - 1 ConsoleWrite("+++: [" & $ndx & "][" & $ndx2 & "] = " & $ar[$ndx][$ndx2] & @CRLF) Next Next EndFunc ;==>test The console output is: +++: $fn ==>C:\Util\AutoIT-src\myStuff\THTracker\Copy of 2016 Easton 100.xlsx<== +++: $ffn ==>C:\Util\AUTOIT~1\myStuff\THTRAC~1\COPYOF~1.XLS<== +++: isObj($obj) = 1 +++: $ar[0][0] = 4 +++: $ar[0][1] = 4 +++: Date = 20160617000000 +++: Time = 0.0416666666666667 +++: [1][1] = 20160617000000 +++: [1][2] = 0.0416666666666667 +++: [1][3] = Date is 6/17/2015, time is 1:00:00 AM +++: Date = 20160617000000 +++: Time = 0.0416782407407407 +++: [2][1] = 20160617000000 +++: [2][2] = 0.0416782407407407 +++: [2][3] = Date is 6/17/2015, time is 1:00:01 AM +++: Date = 20160617000000 +++: Time = 0.0833333333333333 +++: [3][1] = 20160617000000 +++: [3][2] = 0.0833333333333333 +++: [3][3] = Date is 6/17/2015, time is 2:00:00 AM +++: Date = 20160617000000 +++: Time = 0.125 +++: [4][1] = 20160617000000 +++: [4][2] = 0.125 +++: [4][3] = Date is 6/17/2015, time is 3:00:00 AM +>12:52:23 AutoIt3.exe ended.rc:0 +>12:52:23 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.206 Note that the time values [n][2] are all decimal values like 0.0416666666666667, 0.125, etc.
×
×
  • Create New...