Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

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)

Posted

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.

Afraits

"The avalanche has started, it is too late for the pebbles to vote"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...