ASP SQL Server 2000 Date/Time Formating

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

  1. #1

    Default ASP SQL Server 2000 Date/Time Formating

    Hello,

    I have two questions which I would appreciate some help with.

    1. Date Formating when Inserting into SQL Server 2000
    I'm currently passing YYYYMMDD into a datetime field. When I look at
    the database it is in the format MM/DD/YYYY. However, if the date is
    20040303 it's inserted as 3/3/2004. How do I keep the zero's in the
    date when inserting into the database ?

    2. Time Formating when Inserting into SQL Server 2000
    I'm trying to insert military time to a datetime field. Is there a way
    to format this in the database ? I've only had success using hh:mm
    AM/PM. I only want to use military time.

    Thank you so much !

    Chad

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Chad S Guest

  2. Similar Questions and Discussions

    1. date/time field from access 2000 db getting -1 in textbox on form
      I am stuck in using Access 2000 with on Windows 2000 server. I get a negitive 1 for a value. My code $DB_Conn = new...
    2. Exception error with date/time (Access 2000)
      I am picking up a strange exception error for the following statement: If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then '// End If Is...
    3. Formating differenc between Web server (IIS) on WinXP or Win 2000?
      I have developed an bound datagrid on WinXP mit VS.2003 and well formatted the 7 columns. After deploying the project to an Windows 2000 server...
    4. Formating date,time
      Using MySQl and PHP I am trying to get a standard time stamp to for so it reads: Day, d/m/y (Fri, 30/11/03) The database holds the info like...
  3. #2

    Default Re: ASP SQL Server 2000 Date/Time Formating

    On Fri, 20 Feb 2004 09:48:51 -0800, Chad S <webaccess@hotmail.com>
    wrote:
    >I have two questions which I would appreciate some help with.
    >
    >1. Date Formating when Inserting into SQL Server 2000
    >I'm currently passing YYYYMMDD into a datetime field. When I look at
    >the database it is in the format MM/DD/YYYY. However, if the date is
    >20040303 it's inserted as 3/3/2004. How do I keep the zero's in the
    >date when inserting into the database ?
    >
    >2. Time Formating when Inserting into SQL Server 2000
    >I'm trying to insert military time to a datetime field. Is there a way
    >to format this in the database ? I've only had success using hh:mm
    >AM/PM. I only want to use military time.
    You need to understand that DateTime data types in SQL aren't stored
    as any particular format. When you pass formatted date/time strings,
    SQL may or may not get what you wish inserted into the field. You
    format the date/time however you wish in the output, or rely on the
    client settings for this.

    See also:

    [url]http://www.aspfaq.com/show.asp?id=2260[/url]

    Jeff
    Jeff Cochran 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