First of all I would like to remind you to learn how to convert date to different date string using Convert function of ms sql server. This will prepare background for the technique used in this article.
For the sake of easiness, I will use current date and time as the date field we would like to convert to MMDDYY format. As you all know, getdate() returns you current date and time, as below:
select getdate() as Today
Output is: 2015/07/29 05:00:47.563
First we will get this date in mm/dd/yyyy format. Here is how:
Output is: 07/29/15
Now we are almost there! Let replace those forward slashes (/) with empty string. And voila! We have MMDDYY. Here is the script:
Output is: 072915
All the steps are put together below.
Now we have successfully converted datetime field in sql server into MMDDYY format.