Search code examples
sqlsql-servervb.netsql-server-ce

VB and SQL datetime


How can I format a date in Visual Basic to be in sql 121 style (that is yyyy-mm-dd hh:mi:ss.mmm).

I realized that this format is not in the FormatDateTime list of objects.

I want to use this format for Reporting Services.


Solution

  • date.ToString("yyyy-MM-dd HH:mm:ss.fff")
    

    Custom Date and Time Format Strings