Retrieve format of date from date value
<p>I am receiving some data into a variable of type object. In certain cases this data are date values. For that data, I would like to convert this to a string and return it in the same format as it was passed. In some cases, the object could be a datetime, in others a date only or time only values.</p>

<p>As soon as I convert the object to a date or a string, it is obviously given a time of midnight which in my scenario may be a valid time (so I cannot test to see if the time is midnight in which case I could deduce that it would have been a date only date value, nor can I use regex on it as there will always be a time element).</p>

<p>Intellisense shows me it correctly, ie in the format I am wishing to return the value.</p>

<p>Is there an easy way to achieve this (hopefully without using reflection)</p>

<p>Many thx</p>

<p>Simon</p>
