jbrito

Anyone knows an equivalent class of Java's SimpleDateFormat in C#
Code in Java:
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd");
returnValue = dateFormatter.format(todaysDate.getTime());



Re: Visual C# General Java's class SimpleDateFormat in C#

Matthew Watson

It might help if you explained exactly what that Java code does.
I, for one, have no idea...

However, the following code will produce today's date in Y/M/D format:

Console.WriteLine(DateTime.Now.ToString("yyyyMMdd"));




Re: Visual C# General Java's class SimpleDateFormat in C#

Martin Xie - MSFT

Yes, as Matthew stated, you can use "Custom DateTime Format Strings" feature in C#.

Custom DateTime Format Strings

Standard DateTime Format Strings