473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 12826
<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
5
by: Javier | last post by:
I have a field type Date/Time that automatically defaults to Now(). I'm having a problem writing a query that will retrieve all the records for a specific date the user to enters when prompted. I...
3
by: RSB | last post by:
Hi Every one , IS there any Date Time Control with .Net. All i want to read is the Date and Time in a Single Field like 12/31/2004 09:23:23AM. if there is any then any examples for it. and if not...
3
by: MarcJoseph | last post by:
I have a database that is shared my multiple users who enter and update records on a weekly basis. Is there a way I can add a field to my main data table that will automatically generate the...
2
by: drurjen | last post by:
Good morning. I am importing an XLS file into one of my tables. The fields are: Date Id Time IO 12/22/2006 2 12:48:45 PM 9 12/22/2006 16 5:40:55 AM 1 12/22/2006 16 12:03:59 PM 2 ...
7
by: JamesG | last post by:
Hi, I need to convert the current time to the format "hh:mm:ss" and date to the format "yyyy-MM-dd". The result of both conversions needs to be of System.DateTime format. I've tried using...
1
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a...
8
by: sillyr | last post by:
Hi -I created a form where the user enters the date and time landed. I used access 2007 to create the form, but the computer that the user has has access 2002. Date and time are separate fields. ...
13
by: dizzydangler | last post by:
Just a quick question...I'm running an MS Access 2007 db that tracks appointments in a single table. Date and time are entered as separate fields in short date (mm/dd/yyyy) and short time (hh:mm)...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.