DateTime

  • anyperson who can help me to separate 27/09/2005 12:42:32 into 27/09/2005 and 12:42:32 ???

     

    thanxs

  • Try this

    SELECT

    getdate() as CurrentDateTime,

    substring(convert(varchar(100),getdate(),120),9,2)+'/'+

    substring(convert(varchar(100),getdate(),120),6,2)+'/'+

    left(convert(varchar(100),getdate(),120),4) as CurrentDate,

    substring(convert(varchar(100),getdate(),120),12,2)+':'+

    substring(convert(varchar(100),getdate(),120),15,2)+':'+

    right(convert(varchar(100),getdate(),120),2) as CurrentTime

  • select convert(varchar(11),'27/09/2005 12:42:32 ',103)

    Select convert(varchar(10),convert(datetime,'27/09/2005 12:42:32 ',103),108)

     

  • btw this way

    select convert(varchar(11),'27/09/2005 12:42:32 ',103)

    is still error when

    27/09/2005 12:42:32

    i change into

    2/09/2005 12:42:32

     

    anyanother can help me????????

    thanxs you very much for Deni Kusdeni and Ananda Kumar

  • Try

    Set DateFormat dmy

    Declare @dt DateTime

    Set @dt = '2/09/2005 12:42:32'

    select convert(char(10), @dt, 103), convert(char(8), @dt, 108)

     

    Works for me.

    Regards

    Otto

     



    Best Regards,

    Otto Schreibke

    The future is a foreign country, they do things differently there.
    (Stolen from Arthur C Clarke)

  • thanx you very much for Otto.........

     

    i have try it........ anda success

     

    but do you know the simple procedure that have been created by Microsoft SQL Server Team ????

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply