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?

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

Yes Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.