View Single Post
Old Dec 5th, 2005, 14:12   #7 (permalink)
jakyra
Reputable Member
 
Join Date: Sep 2003
Location: USA
Posts: 113
Re: Database connection

We are in the process of switching from Access to MySQL using an ASP app so I worte this script to translate dates into the MySQL format.

Code: Select all
private function mySQLDate(oldDate)
  dim y
  dim mo
  dim d
  dim h
  dim m
  dim s
  dim return
  
  if isdate(oldDate) then 
    y = datepart("yyyy", oldDate)
    mo = datepart("m", oldDate)
    d = datepart("d", oldDate)
    h = datepart("h", oldDate)
    m = datepart("n", oldDate)
    s = datepart("s", oldDate)
                
    return = join(array(y,  mo, d), "-") 
    if h+m+s > 0 then return = return & " " & join(array(h, m, s), ":")
  end if
  mySQLDate = return
end function
No warrently express or implied.
HTH
__________________
jakyra
jakyra is offline   Reply With Quote