I have a string in the format in = "01012012". I want him to convert to: 01-JAN-12. How to achieve this in C #?
DateTime dateTime = DateTime.ParseExact("01012012", "MMddyyyy", CultureInfo.InvariantCulture); string newDateString = dateTime.ToString("dd-MMM-yy");
EDIT: Changed output to 2-digit date (instead of 4)
Got my answer:
CultureInfo provider = CultureInfo.InvariantCulture; DateTime date = DateTime.ParseExact("08312012", "MMddyyyy", provider); string getDate = date.ToString("dd-MMM-yy");
Thanks guys!!!
Source: https://habr.com/ru/post/1437092/More articles:Unix pipes and positional arguments - unixThe powershell command is not running in the .bat file? - shellHow to use custom font in Xcode attribute builder - objective-chttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1437090/index-name-is-too-long-rails-3&usg=ALkJrhjk3uq1qNYcFAvLzDz_NuQeSN14BQMySQL GroupBy and shows it horizontally - sqlCan Meteor work with the back of Microsoft (i.e. EF and ASP.net MVC) - asp.net-mvcplot shapefile in python - pythonHow to enable Reddit / post ranking page algorithm? - algorithmview a polygon read from a shapefile using matplotlib - matplotlibWhy is the local development server not working with Yesod? - windowsAll Articles