Jump to content
Sign in to follow this  
randallc

Date convert from mdb

Recommended Posts

randallc

Hi,

Does anyopne have an idea how to get an MSAccess datum wich is a date-time/; result comes back as "33456.76589" etc as a detailed Julian-type number, and I want it as not only date, but the time component?

I guess I can write a routine to do this, but I wonder if there is an easy command in autoIt, or if I can retrieve it from Access already converted?

thanks, randall

Share this post


Link to post
Share on other sites
Jos

This should be close ... the date calculation needs some more testing

#include<date.au3>
$Input_date = 33456.76589
$date_part = Int($Input_date)
;
Global $iYear,$iMonth, $iDay
Global $Base = _DateToDayValue(1900,01,01) - 1.5
_DayValueToDate($date_part+$Base,$iYear,$iMonth, $iDay)
$Date =  $iMonth & "/" & $iDay & "/" & $iYear
ConsoleWrite('@@ Debug(7) : $Date = ' & $Date & @lf & '>Error code: ' & @error & @lf);### Debug Console

$time_part = int(($Input_date - $date_part) * 24 * 60 * 60 *1000)
Global $iHH,$iMM, $iSS
_TicksToTime($time_part,$iHH,$iMM,$iSS)
$time =  $iHH & ":" & $iMM & ":" & $iSS
ConsoleWrite('@@ Debug(15) : $time = ' & $time & @lf & '>Error code: ' & @error & @lf);### Debug Console

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
randallc

Hi,

That was quick!

Thanks to both; I'll have a look..

Best, Randall

PS

How to Convert Julian Days to Dates in Access and Back

that link only talks about the Date component, which is easy in AutoIt anyway.. Edited by randallc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.