Re: Date and Time query
- From: John Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Aug 2006 12:13:57 -0600
On 16 Aug 2006 09:13:49 -0700, "Monsignor JAV" <jonvillalva@xxxxxxxxx>
wrote:
Hello,
I have imported several thousand lines of data from comma separated
files to a temp import table. In the comma separated values the date
and time of the sample are included in the same field. I need to
extract the date and time to another table but into separate fields and
in a different format than originally imported in from. The date and
time is in a field called [DateTime] as seen below.
7/27/2005 12:00:00 PM
I need to separate the date into the format, yyyymmdd, and the time
into 24 hour format, hhnn using an append query to another table I have
created for storage.
WHY?
An Access Date/Time value stores an exact point in time, as a double
float count of days and fractions of a day, in one field. It can be
formatted ANY WAY YOU LIKE - it's not stored with a format! If you
need to export a date/time value as above, you can simply use two
calculated fields in a query:
Format([datefield], "yyyymmdd")
Format([datefield], "hhnn")
without needing to waste space storing these text strings in your
table.
What's the datatype of the [DateTime] field? Date/Time, or text?
I have tried to use the DatePart in conjunction with the format
operator with no luck. I have also attempted queries using the
DateValue, TimeValue, and Cdate all to no avail. I have tried to do
assemble the query breaking it up in parts just doing the Date part
first but nothing seems to work. Can someone please point me in the
right direction since I only get an invalid expression error or
notification that a parenthesis is not closed. Any help would be
wonderful.
Well, perhaps it would help if you would a) count parentheses and b)
post your expression. We'd be glad to help fix it if we could see it!
John W. Vinson[MVP]
.
- References:
- Date and Time query
- From: Monsignor JAV
- Date and Time query
- Prev by Date: Count contacts who are associated with campaigns
- Next by Date: Re: Inner join on table with NULL's
- Previous by thread: Re: Date and Time query
- Next by thread: Re: re-arranging the data in an access table
- Index(es):
Relevant Pages
|