Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Splitting Date from Time in Access Project

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Randall Arnold - 04 Nov 2005 21:38 GMT
I'm working with a former developer's SQL Server database using an adp.  For
unknown reasons, the developer chose to concatenate date & time in the Date
field of a critical table.  My query needs to only pull out the Date part and
discard time, but I can't find a function that will work for this.  DATEPART
would be proper but none of the intervals I'm aware of will pull it out in
MM/DD/YYYY format.

Any ideas?

Randall Arnold
John Spencer - 04 Nov 2005 22:04 GMT
Not sure if it is available in an ADP, but have you tried DateValue?

> I'm working with a former developer's SQL Server database using an adp.
> For
[quoted text clipped - 10 lines]
>
> Randall Arnold
Randall Arnold - 04 Nov 2005 22:16 GMT
Unfortunately that won't work in an adp, but thanks for the suggestion.

Randall Arnold

> Not sure if it is available in an ADP, but have you tried DateValue?
>
[quoted text clipped - 12 lines]
> >
> > Randall Arnold
Duane Hookom - 04 Nov 2005 23:27 GMT
The date only part:
           Convert(DateTime,Convert(VarChar(11),DateTimeField))

If you have to do this quite often, consider creating your own function that
is the equivalent of DateValue().

-- Function to remove the time value from a date and time
Create Function DateValue
(@DateAndTime datetime)
Returns DateTime
AS
BEGIN
Return Convert( DateTime,Convert(VarChar(11), @DateAndTime) )
END

You can then use the function in your SQL like
 dbo.DateValue(DateAndTimeField)

Signature

Duane Hookom
MS Access MVP
--

> Unfortunately that won't work in an adp, but thanks for the suggestion.
>
[quoted text clipped - 18 lines]
>> >
>> > Randall Arnold
Randall Arnold - 04 Nov 2005 23:51 GMT
Thanks Duane.  Hopefully I'll only have to do this once...

Randall Arnold

> The date only part:
>             Convert(DateTime,Convert(VarChar(11),DateTimeField))
[quoted text clipped - 36 lines]
> >> >
> >> > Randall Arnold
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.