Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004

    Smile Unanswered: SQL Server 2000 Date Format

    Dear All;

    Can anyone tell me how can i change the datetime format in Ms SQL Server 2000.

    During i insert a data from VB to Ms SQL 2000 database, my date field return me the format as "2004-06-30 14:20:31.000". My actual format need like this "Jun 30 2004 02:20:31 PM"

    I have format my coding in VB as "Format(X,"dd/MMM/YYYY HH:MMS"). But this look like something wrong once the data is insert to the table.

    Pls help

  2. #2
    Join Date
    Jun 2004
    Maybe you can create a customised datatype for your date field?

  3. #3
    Join Date
    Jun 2004
    "2004-06-30 14:20:31.000" format is the default format the server saves DATETIME datatype and also depends on servers date format setting. U could write a User Defined Function to format the date as you retrieve the data in the select statement.

  4. #4
    Join Date
    Jun 2003
    Provided Answers: 1
    SQL Server does not store dates in any format. It stores them as numbers.

    It is best to let the your application interface handle how the date is formatted for display, but if you must format the results in your stored procedures use the CONVERT function:

    select convert(varchar(26), getdate(), 109)


    select convert(varchar(19), getdate(), 100)
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

Posting Permissions

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