zachvaldez
asked on
Display Date and Time
I would like to display both date and time as
04/27/2017 01:00 PM . What's the syntax in SQL
In inserting the record it should write this way to in the table
04/27/2017 01:00 PM . What's the syntax in SQL
In inserting the record it should write this way to in the table
ASKER
I did this
CONVERT(varchar,getdate(), 101) + RIGHT(CONVERT(VARCHAR(19), GETDATE(), 100),7), and it work for some time but
now it is getting error...
Simply GetDate() work!
CONVERT(varchar,getdate(),
now it is getting error...
Simply GetDate() work!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi zachvaldez,
Use the below code and you will get the format like 04/29/2017 2:21AM
select convert(varchar(10),getdat e(), 101) + right(convert(varchar(32), getdate(), 100),8)
Regards,
Tapan Pattanaik
Use the below code and you will get the format like 04/29/2017 2:21AM
select convert(varchar(10),getdat
Regards,
Tapan Pattanaik
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys!
No problem. Will you also choose the answer(s) and close the question?
Open in new window
To insert or update..Open in new window
Dates are NOT stored in any particular cosmetic formatting, so to DISPLAY the date as you have in this question choose from any one of SQL expert PortletPaul's Handy Dandy Date Conversion Cheat Sheet.