Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Change Date Format

    I have a date being entered into a textbox in a dd/mm/yy format, however I need to be able to change this format to a yyyy/mm/dd in order to pass the date into a stored procedure and run some asp code. Does anyone know how to do this date format change in the background say on the onclick event of a button
    Stephen Cairns Guest

  2. Similar Questions and Discussions

    1. date format change from YYYYMMDD?
      We are in the process of migrating our database server over to a new system. The old system has Coldfusion 4.5, Win2k Server and MS SQL 2000. We're...
    2. Format a date
      My database stores the date as mm/dd/yyyy How can I return this in the format of say: Tuesday- December 21, 2005
    3. Date format change not working
      Im trying to change the date format entered into a textbox from dd/mm/yy to yyyy/mm/dd so as my stored procedure is run correclty. The date is...
    4. converting date into database date format(newbie)
      Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?>
    5. Nautulus: time/date format change ?
      I run RH9 with Gnome / Nautilus. I am irritated by the time/date format in Nautilus. like : " Wednesday, July 9 2003 at 10:44:14 PM " ! Does...
  3. #2

    Default Re: Change Date Format

    Stephen Cairns wrote:
    > I have a date being entered into a textbox in a dd/mm/yy format,
    > however I need to be able to change this format to a yyyy/mm/dd in
    > order to pass the date into a stored procedure and run some asp code.
    > Does anyone know how to do this date format change in the background
    > say on the onclick event of a button
    [url]http://www.aspfaq.com/show.asp?id=2313[/url] vbscript
    [url]http://www.aspfaq.com/show.asp?id=2040[/url] help with dates
    [url]http://www.aspfaq.com/show.asp?id=2260[/url] dd/mm/yyy confusion

    HTH,
    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: Change Date Format

    Function ISODate(ByVal strDate)

    Dim strFormat

    strFormat = "%Y-%M-%D"
    ' Insert Padded Day of Month
    strFormat = Replace(strFormat, "%D", Right("0" & DatePart("d", strDate),
    2), 1, -1, vbBinaryCompare)

    ' Insert Padded Month Numbers
    strFormat = Replace(strFormat, "%M", Right("0" & DatePart("m", strDate),
    2), 1, -1, vbBinaryCompare)

    ' Insert Long Year (4 digit)
    strFormat = Replace(strFormat, "%Y", DatePart("yyyy",strDate), 1, -1,
    vbBinaryCompare)

    ISODate = strFormat

    End Function


    Chris


    "Stephen Cairns" <S.Cairns@belfasttelegraph.co.uk> wrote in message
    news:C17D0C30-1BBE-446A-8A9E-D36FF73AB76E@microsoft.com...
    > I have a date being entered into a textbox in a dd/mm/yy format, however I
    need to be able to change this format to a yyyy/mm/dd in order to pass the
    date into a stored procedure and run some asp code. Does anyone know how to
    do this date format change in the background say on the onclick event of a
    button


    CJM Guest

  5. #4

    Default Re: Change Date Format

    >> yyyy/mm/dd in order to pass the date into a stored procedure

    The only safe date-only format to pass to SQL Server is YYYYMMDD. Any other
    format is vulnerable to ambiguous interpretation.


    Aaron Bertrand [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may 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