Previous Topic

Next Topic

Inhoudsopgave

Book Index

Conversion Of Date, Time And DateTime To A String Type

Both ASE and MS SQL Server can implicitly and explicitly convert date, time or datetime values to a string and vice versa. However, there is a small difference when you use implicit conversion. If you implicitly convert a date, time or datetime value to a string, the representation is slightly different on both systems.

Example

declare @D date, @T time, @DT datetime

select @D = GetDate(), @T = GetDate(), @DT = GetDate()

select @D as 'Date', @T as 'Time', @DT as 'DateTime'

 

Date

Time

DateTime

ASE

Sep 30 2011

3:24PM

Sep 30 2011 3:24PM

MS SQL Server

2011-09-30

15:24:29.8600000

2011-09-30 15:24:29.860