Re: Date format for SQL Server

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jeff Johnson [MVP: VB] (i.get_at_enough.spam)
Date: 10/25/04


Date: Mon, 25 Oct 2004 13:24:40 -0400


"Newbie" <noidea@nospam.com> wrote in message
news:uaDPVmquEHA.1452@TK2MSFTNGP11.phx.gbl...

>I have a stored procedure in SQL Server that requires a date parameter.
>
> I have a 2 public variables (Date Type) that give a datefrom and a dateto.
> The datefrom and dateto are derived using DateSerial.
>
> I believe that SQL needs the dates in "mm/dd/yyyy" format but the
> variables
> are in "dd/mm/yyyy" format. How can I change this?

If the parameter is defined as a date (adDate if you're using ADO) and you
have a real Date variable, simply assign that variable directly to the
parameter; no conversion necessary. In fact, it's the conversion that's the
source of your troubles, as you're trying to assign a string to a date.



Relevant Pages

  • Re: Date format for SQL Server
    ... SQL Query Analyser records are returned. ... >> The datefrom and dateto are derived using DateSerial. ... > If the parameter is defined as a date (adDate if you're using ADO) and you ...
    (microsoft.public.vb.syntax)
  • Re: Datumsdifferenz o. Samstage u. Sonntage
    ... Dim i As Long, j As Long ... Public Function countWeekDays(DateFrom As Date, DateTo As Date) As Long ... If DateFrom> DateTo Then ...
    (microsoft.public.de.access)
  • RE: Finding the amount of days between two dates.
    ... "NateBuckley" wrote: ... "Mike H" wrote: ... DateFrom = 01/04/08 ... DateTo = 04/04/08 ...
    (microsoft.public.excel.programming)
  • RE: Finding the amount of days between two dates.
    ... "NateBuckley" wrote: ... life of me I can't figure this out. ... DateFrom = 01/04/08 ... DateTo = 04/04/08 ...
    (microsoft.public.excel.programming)
  • Re: Interval search
    ... >> Remi-Noel ... > I'd recommend instead to use DateTo and DateFrom as global fields, ...
    (comp.databases.filemaker)