View Single Post
  #1   Report Post  
Posted to microsoft.public.access,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 419
Default Recreating the DateSerial()/Date() function

Hello all,

x-posted on:
microsoft.public.access
microsoft.public.excel.programming
microsoft.public.excel.worksheet.functions

Does anyone know the logic behind the DateSerial() function in AC/VBA
(Date() in XL). I want to recreate this function in SQL Server, but have no
idea about how to tackle the logic.

Right now, I have a basic version that will only accept 1-12 for the month
argument and 1-31 for the day argument (I hope no one ever asks for the 31st
of February!!! KABOOM!!!)

I'm fairly certain I can figure out the logic for the month argument so it
will accept negative numbers or 12 and adjust the year accordingly, but I
have no idea how to handle the Day argument to do the same thing. Also, I
don't know which argument needs to get calculated first.

Thanks for any help anyone can provide,

Conan Kelly