Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Convert date/Time string to date valid in an db import in MS Access

by SteinerKD (Acolyte)
on Aug 05, 2010 at 00:45 UTC ( #852999=perlquestion: print w/replies, xml ) Need Help??
SteinerKD has asked for the wisdom of the Perl Monks concerning the following question:

I've got my script working fine now collecting data for me, however I fail to import it into my DB and it seems the date fields are the culprit (MS Access hissyfits and says "Type Conversion Failure" for ever date/time field.

All time references grabbed are in this format "Jul 24 00:33" and needs to converted to something Access will accept. Is there any relatively easy way to accomplish this so it can be done on the fly when I collect those fields before I store them to file?

  • Comment on Convert date/Time string to date valid in an db import in MS Access

Replies are listed 'Best First'.
Re: Convert date/Time string to date valid in an db import in MS Access
by bobf (Monsignor) on Aug 05, 2010 at 03:41 UTC
Re: Convert date/Time string to date valid in an db import in MS Access
by aquarium (Curate) on Aug 05, 2010 at 01:26 UTC
    It's been a long time so can't remember the full details. In Access you can setup a import format file and use it through the import wizard in Access. Otherwise can't remember the default format but i'm sure Access Help lookup on import will help.
    If you're going to do this on perl side, much better to use solid date/time module rather than writing own date/time functions, as there are a few gotchas, and the modules can work with many different formats for date/time.
    Also noticed that Year is missing from the date. Unless you're absolutely and positively sure that you'll never need the year from the date, it should be there to start with. Assuming current year during import and other such things are likely to bite back.
    the hardest line to type correctly is: stty erase ^H
Re: Convert date/Time string to date valid in an db import in MS Access
by Anonymous Monk on Aug 05, 2010 at 00:47 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://852999]
Approved by planetscape
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-07-21 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (442 votes). Check out past polls.

    Notices?