0

Hi all,
here is a simple question.
How would you get a C# STRING representing the current time in the following format:

YYYY-DD-MM

I am currently using DateTime.Now but that gives me something like this:

8/13/2009 12:57:47 PM

So I want to
1) remove the houre (I need date only)
2) replace " / " with " - "
3) rearange based on YYYY-DD-MM
4) Convert to STRING type

Can someone get me started?

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by etm9413
0

Hey,
If I got what you were asking I think should work:

(DateTime.Now.Year + "-" + DateTime.Now.Day + "-" + DateTime.Now.Month).ToString();

For example, on Thursday, August 13, 2009 it returns: 2009-13-8

Hope this helps you,
Johnny Goodlad

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.