devxlogo

GetDBDate – Formatting a date as a DateSerial for Access

GetDBDate – Formatting a date as a DateSerial for Access

' Format a date as a DateSerial for Access' Example: Debug.Print GetDBDate(date)Public Function GetDBDate(sDate As String) As String   On Error GoTo ERROR_GetDBDate   Dim sTmp As String   If IsDate(sDate) = False Then      sTmp = sDate   Else      sTmp = "DateSerial(" & Year(sDate) & ", " & Month(sDate) & ", " & Day _          (sDate) & ")"   End IfEXIT_GetDBDate:   GetDBDate = sTmp   Exit FunctionERROR_GetDBDate:   sTmp = sDate   Resume EXIT_GetDBDateEnd Function'========================================' You can find more routines like this on www.vbdiamond.com,'  a site devoted to  VB developers'========================================

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist