Subject: Date from timedate stamp
Posted By: badgolfer Post Date: 11/17/2003 3:17:32 PM
I have a simple Access table and one field is a timedate stamp.
I wish to retrieve only the date value ( the value and not
a formatted date string).

ie select mydate from mytable

this just gives me for example 01/10/2003 00:00:00

how do I do a select that just gives me 01/10/2003 ?

Any help appreciated
Reply By: sal Reply Date: 11/17/2003 4:30:50 PM
If you are trying to get the value out of a query. do as follows

In design view on the query, click on "field" on the field that you wish to change (your date field from the table).
Click on properties on the toolbar
on the general tab opf properties, click on format.
select "Short Date" from the drop down.

You can do the same in reports and forms.

Does this help?






Sal
Reply By: badgolfer Reply Date: 11/18/2003 3:46:24 AM
Unfortuantely I cannot change the field in the database to be
a shortdate because other applications write a full datetime into this field. I need an Access syntax that only retrieves
the date part of the datetime field.

Reply By: Braxis Reply Date: 11/18/2003 4:29:58 AM
As Access holds dates as double precision numbers, there is no such thing as just a date field, or just a time field.

To illustrate this, try the following in the immediate window of the VBE:

?cdbl(time())
?cdbl(Date())
?cdbl(Now())

?cdate(1345.5433)
?cdate(0.5433)
?cdate(1345.0)

So, the formatted date string is your best bet really.


Brian Skelton
Braxis Computer Services Ltd.
Reply By: sal Reply Date: 11/18/2003 9:33:12 AM
You can try this

Inside the design view of a query create a field and enter this

x: Format([YourDateField],"mm/dd/yyyy")

Substitute YourDateField with the name of your field.
This will create a field with the title of "x" that only has the date you need.

Then if you where looking in the query for all entries with the date of today do this
under the criteria

#11/18/2003#

Does this help?



Sal
Reply By: badgolfer Reply Date: 11/19/2003 6:59:57 AM

Hi sal,

yep that does it fine
Many thanks

Chas.


Go to topic 2441

Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996
Return to index page 995
Return to index page 994
Return to index page 993