mike55 Posted April 19, 2005 Posted April 19, 2005 Hi I am doing a select statement on a table via a stored procedure. One of the rows selected is of type datetime. I need to trim the date time in such a way that the date time is only in the format dd/mm/yyyy not dd/mm/yyyy hh:mm:ss. When I select the data I insert it into a dataset table, which is then binded to a datagrid. Any suggestions?? Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Afraits Posted April 19, 2005 Posted April 19, 2005 CONVERT(varchar(12),DateField,103) will return just the date part of the field without the time in the format dd/mm/yyyy. Note that this will return the date as a string variable, if you want to keep it as a date (eg for sorting purposes) then using the datagrid to format the date to the desired format may be a better way of dealing with it. Quote Afraits "The avalanche has started, it is too late for the pebbles to vote"
Moderators Robby Posted April 22, 2005 Moderators Posted April 22, 2005 If you want the format to take place at the datagrid level then add this "{0:D}" to the eval argument (2) Quote Visit...Bassic Software
kcwallace Posted April 28, 2005 Posted April 28, 2005 Is there a help file for this SQL Server Function I can read? CONVERT(varchar(12),DateField,103) meaning what if I use 101 instead of 103 Quote Go Beavs!!!
Mister E Posted April 28, 2005 Posted April 28, 2005 Is there a help file for this SQL Server Function I can read? CONVERT(varchar(12),DateField,103) meaning what if I use 101 instead of 103 http://msdn.microsoft.com/library/en-us/tsqlref/ts_ca-co_2f3o.asp?frame=true Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.