By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,002 Members | 2,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,002 IT Pros & Developers. It's quick & easy.

separate date with time

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
<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

P: n/a

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

P: n/a
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.