Group:  Microsoft Access ยป microsoft.public.access.externaldata
Thread: Import date/time into Access

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Import date/time into Access
DaveLerman 18.07.2006 15:25:01
I am trying to import date/time information from a .csv file. The information
is in iso format of YYYY-MM-DDTHH:MM:SSZ. How can I get this into a datetime
field of Access. Also, does Access actually store a date and time in a single
field, or must they be broken into a date field and a time field?

Thanks,
Dave
RE: Import date/time into Access
Jeff C 18.07.2006 19:16:01
May be the long way but it works:

in a query do something like this:

Year:Left([datefield],4), Month:Mid([datefield],6,2),
Day:Mid([datefield],9,2), Time:Mid([datefield],etc,etc)

then NewDate:[Month]&"/"&[Day]&"/"&[Year]&" "&[Time]

and finally FormattedDate:CVDate([NewDate])

see also entries at http://www.allenbrowne.com/tips.html
--
Jeff C
Live Well .. Be Happy In All You Do


"DaveLerman" wrote:

[Quoted Text]
> I am trying to import date/time information from a .csv file. The information
> is in iso format of YYYY-MM-DDTHH:MM:SSZ. How can I get this into a datetime
> field of Access. Also, does Access actually store a date and time in a single
> field, or must they be broken into a date field and a time field?
>
> Thanks,
> Dave
RE: Import date/time into Access
DaveLerman 18.07.2006 20:10:02
Hi Jeff,

Thanks for your quick reply. This works for me. It seems my problem was with
the letters T and Z used as delimeters and the Access time\date field holds
both date and time together just fine.

-Dave

"Jeff C" wrote:

[Quoted Text]
> May be the long way but it works:
>
> in a query do something like this:
>
> Year:Left([datefield],4), Month:Mid([datefield],6,2),
> Day:Mid([datefield],9,2), Time:Mid([datefield],etc,etc)
>
> then NewDate:[Month]&"/"&[Day]&"/"&[Year]&" "&[Time]
>
> and finally FormattedDate:CVDate([NewDate])
>
> see also entries at http://www.allenbrowne.com/tips.html
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "DaveLerman" wrote:
>
> > I am trying to import date/time information from a .csv file. The information
> > is in iso format of YYYY-MM-DDTHH:MM:SSZ. How can I get this into a datetime
> > field of Access. Also, does Access actually store a date and time in a single
> > field, or must they be broken into a date field and a time field?
> >
> > Thanks,
> > Dave
Re: Import date/time into Access
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 18.07.2006 21:02:08
I'd recommend using

NewDate: DateSerial([Year], [Month], [Day]) + CDate([Time])

Not everyone uses mm/dd/yyyy as their Short Date format!

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Jeff C" <JeffC[ at ]discussions.microsoft.com> wrote in message
news:FD334183-E90C-4E8D-A232-556DB1AC2F2E[ at ]microsoft.com...
[Quoted Text]
> May be the long way but it works:
>
> in a query do something like this:
>
> Year:Left([datefield],4), Month:Mid([datefield],6,2),
> Day:Mid([datefield],9,2), Time:Mid([datefield],etc,etc)
>
> then NewDate:[Month]&"/"&[Day]&"/"&[Year]&" "&[Time]
>
> and finally FormattedDate:CVDate([NewDate])
>
> see also entries at http://www.allenbrowne.com/tips.html
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
>
> "DaveLerman" wrote:
>
>> I am trying to import date/time information from a .csv file. The
>> information
>> is in iso format of YYYY-MM-DDTHH:MM:SSZ. How can I get this into a
>> datetime
>> field of Access. Also, does Access actually store a date and time in a
>> single
>> field, or must they be broken into a date field and a time field?
>>
>> Thanks,
>> Dave


Re: Import date/time into Access
DavidAtCaspian 19.07.2006 08:56:02

Actually I suspect that more people don't use mm/dd/yyyy than do.


"Douglas J. Steele" wrote:

[Quoted Text]
> I'd recommend using
>
> NewDate: DateSerial([Year], [Month], [Day]) + CDate([Time])
>
> Not everyone uses mm/dd/yyyy as their Short Date format!
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Jeff C" <JeffC[ at ]discussions.microsoft.com> wrote in message
> news:FD334183-E90C-4E8D-A232-556DB1AC2F2E[ at ]microsoft.com...
> > May be the long way but it works:
> >
> > in a query do something like this:
> >
> > Year:Left([datefield],4), Month:Mid([datefield],6,2),
> > Day:Mid([datefield],9,2), Time:Mid([datefield],etc,etc)
> >
> > then NewDate:[Month]&"/"&[Day]&"/"&[Year]&" "&[Time]
> >
> > and finally FormattedDate:CVDate([NewDate])
> >
> > see also entries at http://www.allenbrowne.com/tips.html
> > --
> > Jeff C
> > Live Well .. Be Happy In All You Do
> >
> >
> > "DaveLerman" wrote:
> >
> >> I am trying to import date/time information from a .csv file. The
> >> information
> >> is in iso format of YYYY-MM-DDTHH:MM:SSZ. How can I get this into a
> >> datetime
> >> field of Access. Also, does Access actually store a date and time in a
> >> single
> >> field, or must they be broken into a date field and a time field?
> >>
> >> Thanks,
> >> Dave
>
>
>
Re: Import date/time into Access
"JimO" <j~no~spam~[ at ]ThePostOffice.com> 27.07.2006 18:11:55
I just ran into this problem myself. Possibly because I use import
specifications this problem appears to be a trivial matter. Perhaps an MVP
can tell me what I am overlooking. (Hint: I found this solution out by
error.)

The database was created and the field made Date/Time.

The import specification was created and the field made Text.

The string is properly converted to a date/time field. This was tested on
Access 2002 (10.43) SP3.

JimO


Re: Import date/time into Access
"JimO" <j~no~spam~[ at ]ThePostOffice.com> 27.07.2006 19:16:05
[Quoted Text]
>How can I get this into a datetime field of Access.

I use Import Specifications for importing text files. The solution I
accidentally found works but perhaps an MVP will tell my why it shouldn't be
used.

The Import Specification field is defined as text.
The Database field is defined as Date/Time.

All is well.


PS. In case of a double post please accept my apologies. I waited about
almost an hour (I think) and my response still had not appeared.


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net