I want to convert DateTime
to String
.
check the below code.
namespace TestDateConvertion
{
class Program
{
static void Main(string[] args)
{
object value = new DateTime(2003,12,23,6,22,30);
DateTime result = (DateTime)value;
Console.WriteLine(result.ToString("dd/MM/yyyy"));
Console.ReadLine();
}
}
}
I have changed my system date format to Faeroese.
and I am getting the output as
23-12-2013
How should I get the output as ?
23/12/2013
And consider this another scenario, suppose, i have a Customculture Info , and i want to convert my date w.r.t my custom culture, what i was doing before was as follows,
string.Format(customCulture, "{0:G}", result);
now how shall i get the datetime in string using customCulture and it should not depend on system DateTime?