c# - How to convert textbox value ddmmyyyy to dd-mm-yyyy? -


i have textbox in project user enters date, ddmmyyyy. need convert dd-mm-yyyy format fetch particular data database.

you can parse string datetime first , generate it's string representation that format.

for example;

var s = "11062016"; var dt = datetime.parseexact(s, "ddmmyyyy", cultureinfo.invariantculture); console.writeline(dt.tostring("dd-mm-yyyy", cultureinfo.invariantculture)); 

by way, assume wanna mm instead of mm since mm specifier minutes mm specifier months.

on other hand, never told data wanna fetch but, not idea datetime values (if are) strings. use datetime values datetime data database (which of of rdms supports), not strings.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -