[AccessD] Convert SQL Server Date/Time to Date

Heenan, Lambert Lambert.Heenan at AIG.com
Fri May 19 08:21:26 CDT 2006


In Access land, using Format will give you a *String* that looks like a
date. If you want an actual Date type try...

	Cdate(Int(SomeDateField))

Using Int() strips off the decimal fraction, which is the time of day, and
the remaining integer value is then converted to a real date type.

HTH

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
Sent: Thursday, May 18, 2006 5:58 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Convert SQL Server Date/Time to Date


Hi Chester

Assume your Date Field is called 'SomeDateField
(I'm an Aussie so we order our dates as Date/Month/Year)

In Access...
	Format(Me.SomeDAteField, "dd/mm/yyyy)
In SQL
	convert (char(10), SomeTableName.SomeDateField, 103)  AS 'SomeDate' 

Hope this helps

Have a great day
 
Darren
------------------------------
T: 0424 696 433
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Friday, 19 May 2006 7:49 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Convert SQL Server Date/Time to Date

I have an access database linked to an SQL server table. SQL server stores a
time with the date. I want to extract only the date part when using this
field in a query. I know I have done it before but can someone refresh my
memory. Thanks.

 

Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

FAX (432) 688-3799

 

 

No trees were killed in the sending of this message. However a large number
of electrons were terribly inconvenienced.

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list