How to use a select query to extract date from a Datetime field

  • Thread starter Thread starter Pooja Raisingani via AccessMonster.com
  • Start date Start date
P

Pooja Raisingani via AccessMonster.com

Hello,

Can anyone please tell me

How to use a select query to extract date from a Datetime field in Access 2000??

Thanks
 
Shall be much obliged if you would elaborate as to what you mean by extracting date from a DateTime field in Access 2000.
There are far number of options which allows you to extract a date or a range of dates based on the date field itself and/or respective field values.
There is also a question of how you would like to use the extracted date(s). In other words, you could display the extracted date(s) on a text box, label, list box, combo box - all these on a form, and/or write them to a (temporary) table or use them with another query, and/or display them on a report. The options are endless.
For obtaining a quick and methodical solution from the newsgroup, I would suggest that you post a sample data of the table.
 
Add a column with something like the following...


NewDate: Format([SomeDateTimeField],"short date")
 
That will return the date as a string.

If you want to return the date as a date (i.e. as a numeric value), use
NewDate: DateValue([SomeDateTimeField])


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Rick B said:
Add a column with something like the following...


NewDate: Format([SomeDateTimeField],"short date")


message news:[email protected]...
Hello,

Can anyone please tell me

How to use a select query to extract date from a Datetime field in
Access
2000??

Thanks
 
In a table DefectMaster i have one field called RegDate as DATETIME Type in which both Date as well as time are inserted like

12/13/2003 3:19:52 PM

now from this type of data, using select query i want to extract dates which are greater than say

12/1/2003.....

so i have written query like

SELECT *
FROM defectmaster
WHERE format([DefectMaster].[RegDate],"mm/dd/yyyy")>#12/1/2003#;

but it is not giving output.

Thanks
 
Try

WHERE DateValue([DefectMaster].[RegDate])>#12/1/2003#

Format returns a string, and you may be running into problems with how data
types get coerced behind the scenes.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Pooja Raisingani via AccessMonster.com said:
In a table DefectMaster i have one field called RegDate as DATETIME Type
in which both Date as well as time are inserted like
12/13/2003 3:19:52 PM

now from this type of data, using select query i want to extract dates which are greater than say

12/1/2003.....

so i have written query like

SELECT *
FROM defectmaster
WHERE format([DefectMaster].[RegDate],"mm/dd/yyyy")>#12/1/2003#;

but it is not giving output.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top