Professional Web Applications Themes

Convert date/time to date in SQL Server 2000 statement - ASP

Can this be done? tia...

Sponsored Links
  1. #1

    Default Convert date/time to date in SQL Server 2000 statement

    Can this be done?

    tia



    Sponsored Links
    Greg Wiskotter Guest

  2. #2

    Default Re: Convert date/time to date in SQL Server 2000 statement

    Yes, can you show an example of what you are looking for? Maybe:

    SELECT CONVERT(CHAR(8), GETDATE(), 112)





    "Greg Wiskotter" <dsfdfsdfdfsdfsdfwesdfsdfsdf34234sdfsd.com> wrote in
    message news:#cIASv0lDHA.1672TK2MSFTNGP09.phx.gbl...
    > Can this be done?
    >
    > tia
    >
    >
    >

    Aaron Bertrand - MVP Guest

  3. #3

    Default Re: Convert date/time to date in SQL Server 2000 statement

    <%
    'This function recieves a date from text string in format dd/mm/yy or
    dd/mm/ccyy
    'And creates a string that is compatible with inserting into sql as a
    datetime field
    'If an empty string is passed it just passes back trimmed original
    'Write Value Test value to sql database 'datetime' field
    'Added 16/04/2003
    'If a 2 digit year is passed then 20 is prepended onto year to build a CCYY
    year

    '---------
    'sValues = " NULLIF('" & convdate(sDate) & "','')"
    '---------
    'pass a date as dd/mm/yy
    Function convDate(theDate)
    Dim Itemp
    If TRIM(theDate) <> "" Then
    sTemp = cdate(theDate)
    dteArray = Split(sTemp,"/",-1,1)
    If LenB(dteArray(2)) = 2 Then
    dteArray(2) = "20" & dteArray(2)
    End If
    convDate =dteArray(2) & "/" & dteArray(1) & "/" & dteArray(0)
    Else
    convDate = Trim(theDate)
    End If

    End Function
    %>


    "Greg Wiskotter" <dsfdfsdfdfsdfsdfwesdfsdfsdf34234sdfsd.com> wrote in
    message news:%23cIASv0lDHA.1672TK2MSFTNGP09.phx.gbl...
    > Can this be done?
    >
    > tia
    >
    >
    >

    Don Grover Guest

  4. #4

    Default Re: Convert date/time to date in SQL Server 2000 statement

    On Mon, 20 Oct 2003 13:50:41 -0700, "Greg Wiskotter"
    <dsfdfsdfdfsdfsdfwesdfsdfsdf34234sdfsd.com> wrote:
    >Can this be done?
    FWIW, I prefer to handle the display of the date/time in the VBScript
    instead of the query. I don't know that there's any difference in
    performance or utility, it just seems cleaner to me to handle the
    presentation in the ASP code rather than the query. This assumes a
    date/time field in your database and the date isn't simply stored in a
    text field. Though that can work too.

    When I do need to do a date/time SELECT, I like Aaron's method if it
    fits your needs.

    Jeff
    Jeff Cochran Guest

Similar Threads

  1. How to get FMS server time and date
    By shrimusic in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: November 30th, 06:09 AM
  2. CFMX7.0.1 Administrator date time issue showing 13hrsbehind server time
    By bayfield in forum Coldfusion Server Administration
    Replies: 0
    Last Post: December 8th, 04:34 AM
  3. Replies: 0
    Last Post: August 29th, 12:19 AM
  4. Replies: 2
    Last Post: August 3rd, 04:00 PM
  5. ASP SQL Server 2000 Date/Time Formating
    By Chad S in forum ASP Database
    Replies: 1
    Last Post: February 20th, 06:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139