|
hi i have a textfield taking a string representing a specific DateTime format. I want the string representing the DateTime to be formatted as YYYY-MM-DD, how can i do this? thanks
(comments are locked)
|
|
Use DateTime.TryParse. You'll probably run into issues if you try to overwrite the string the user is typing while they do that, but if you have an input field and a separate display field that shows the "parsed" date time (formatted like Duck's answer) that would work.
(comments are locked)
|
|
Is your value coming from an actual DateTime object? If so, you can do this: no my value is comming from the text field which is a string
Jun 04 '10 at 12:35 PM
Ruben
ok in that case your question isn't very clear. You have it in a string already, and you want it formatted in a different way? What format is it to begin with?
Jun 04 '10 at 03:07 PM
duck ♦♦
@Duck, I suspect he means, that a user could enter some random text into a Textfield, and he wants to clean it up. But who knows?
Jun 04 '10 at 04:22 PM
Cyclops
(comments are locked)
|
