Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Dates from SQL to Access

Status
Not open for further replies.

smorgan77

Programmer
Nov 15, 2007
8
US
I have a linked table from SQL 2005 and the date format is YYYY-MM-DD HH:MM:SS. I need to populate an Oracle table with the date, but the format is different, it's YYYYMMDD. I can't find the correct way to convert this in Access.
 
Hi,

The following will return 2009/08/27 from 2009/08/27 09:00:00 AM
Code:
Dim dt as date
dt = Now()
dt = Format(dt, "yyyy, mm, dd")

If you are looking for 20090827 then you will probably have to parse out the date components and reconstitute as a string which can then be passed to Oracle to be reconverted back to a date value.

Cheers, Bill
 


Hi,

The Format function returns a STRING.
Code:
Dim sDt as string
sDt = Format(Now(), "yyyymmdd")

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I wouldn't think it would matter the format of the date unless there was a United states vs someplace else issue and you were concerned about month day vs day month.

If it is text to start, you may want to start with the CDate function.

Regardless, the format function is part of the solution if you are using text and format matters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top