Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date with time

Author  Topic 

satheesh
Posting Yak Master

152 Posts

Posted - 2011-09-23 : 05:32:39
Dear All,

Sorry for posting this basic question.But i havent found the correct code.

I need to display date in DD/MM/YYYY HH:MI format.for eg(14/08/2011 08:06)


CONVERT(VARCHAR(10),policy.PolicyStartDate, 103) AS Startdate
returns:14/08/2011

But i need date with time?what is the code for this?

Any help is appreciated.

Thanks,
Sg

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-23 : 05:41:03
why do you need to do this in sql? its just a formatting that can be very easily achievable in the front end application using formatting functions.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-23 : 05:51:53
if you've no way to hanlde this at front end use
select CONVERT(VARCHAR(10),policy.PolicyStartDate, 103) + ' ' +  CONVERT(VARCHAR(5),policy.PolicyStartDate, 114) AS Startdate FROM Table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -