I have this date format yy/MM/dd HH:mm:ss
ex: 12/02/21 10:56:09
. The problem is, when i try to convert it to different format using this code:
CDate("12/02/21 10:56:09").ToString("MMM. dd, yyyy HH:mm:ss")
It displays Dec. 12, 2021 10:56:09
.
How can i correctly format it to: Feb. 21, 2012 10:56:09
? This format is returned when i check balance inquiry fro my SMS based application.
This question is related to
c#
.net
vb.net
datetime-format
Easy peasy:
var date = DateTime.Parse("14/11/2011"); // may need some Culture help here
Console.Write(date.ToString("yyyy-MM-dd"));
Take a look at DateTime.ToString() method, Custom Date and Time Format Strings and Standard Date and Time Format Strings
string customFormattedDateTimeString = DateTime.Now.ToString("yyyy-MM-dd");
Source: Stackoverflow.com