468,507 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,507 developers. It's quick & easy.

separate date with time

Hi: Data in my table is in that format. How to i separate date with
time.

11/9/2006 10:10:46 AM

Thank You.

Nov 9 '06 #1
3 11615
<co*********@gmail.comwrote
Hi: Data in my table is in that format. How
to i separate date with time.

11/9/2006 10:10:46 AM
There is no "date only" field, nor "time only" field. There is only a
date/time field. But it is easy to extract just the date or just the time
from a Date/Time field:

datSomeDate = Date(Me.txtMyDateAndTime)
timSomeTime = Time(Me.txtMyDateAndTime)

A Date/Time Field set only to the Date should show a time of Midnight.

A Date/Time Field set only to Time will show that time with a date of Dec.
30, 1899.

Larry Linson
Microsoft Access MVP
Nov 9 '06 #2

Larry Linson wrote:
<co*********@gmail.comwrote
Hi: Data in my table is in that format. How
to i separate date with time.
>
11/9/2006 10:10:46 AM

There is no "date only" field, nor "time only" field. There is only a
date/time field. But it is easy to extract just the date or just the time
from a Date/Time field:

datSomeDate = Date(Me.txtMyDateAndTime)
timSomeTime = Time(Me.txtMyDateAndTime)

A Date/Time Field set only to the Date should show a time of Midnight.

A Date/Time Field set only to Time will show that time with a date of Dec.
30, 1899.

Larry Linson
Microsoft Access MVP
I was unaware that VBA Date() and Time() took arguments. In fact I'm
having trouble getting this to work under Access 2003. Are you sure
you haven't superseded the VBA functions with your own?

I've always used format() for this, e.g.

format("11/9/2006 10:10:46 AM","m/d/yyyy") = "11/9/2006"
format("11/9/2006 10:10:46 AM","h:nn AM/PM") ="10:10 AM"
format("11/9/2006 10:10:46 AM","h:nn:ss AM/PM") ="10:10:46 AM"

Bruce

Nov 9 '06 #3
Thanks for the catch. I guess I was thinking of setting a Date/Time variable
or field with the Date or Time function. But "many a slip twixt the
fingertips and the newsgroup" is all I can claim. Sorry, folks.

Larry


<de***************@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
>
Larry Linson wrote:
><co*********@gmail.comwrote
> Hi: Data in my table is in that format. How
to i separate date with time.

11/9/2006 10:10:46 AM

There is no "date only" field, nor "time only" field. There is only a
date/time field. But it is easy to extract just the date or just the time
from a Date/Time field:

datSomeDate = Date(Me.txtMyDateAndTime)
timSomeTime = Time(Me.txtMyDateAndTime)

A Date/Time Field set only to the Date should show a time of Midnight.

A Date/Time Field set only to Time will show that time with a date of
Dec.
30, 1899.

Larry Linson
Microsoft Access MVP

I was unaware that VBA Date() and Time() took arguments. In fact I'm
having trouble getting this to work under Access 2003. Are you sure
you haven't superseded the VBA functions with your own?

I've always used format() for this, e.g.

format("11/9/2006 10:10:46 AM","m/d/yyyy") = "11/9/2006"
format("11/9/2006 10:10:46 AM","h:nn AM/PM") ="10:10 AM"
format("11/9/2006 10:10:46 AM","h:nn:ss AM/PM") ="10:10:46 AM"

Bruce

Nov 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
5 posts views Thread by Javier | last post: by
3 posts views Thread by RSB | last post: by
7 posts views Thread by JamesG | last post: by
8 posts views Thread by sillyr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.