It is enough to print DateTime values ​​in C #

I hope someone found a way to do this already or that there is already an existing library. This is one of those things that would be good, but not yet needed.

The functionality I'm looking for is similar to datejs in the reverse order.

Thanks,

Simon.


Thank you, using something like the dddd example may be a good start for usability. The more I think about this problem, the more it depends on the values ​​used. I specifically deal with a series of timestamped versions of the document, so there is a good chance that they will be grouped. It's not so hot today if you saved it three times in the last five minutes.

If I come up with something, I will share it with the community.

+4
source share
2 answers

In fact, what you really need is a custom DateTime Format string: http://msdn.microsoft.com/en-us/library/8kb3ddd4(VS.71).aspx

DateTime.Now.ToString("ggyyyy$dd-MMM (dddd)") 

"AD2008 $ 06-Nov (Thursday)" will return if you need it.

And to get something closr to datejs ("forward"), you can use the same lines in DateTime.ParseExact()

+8
source

All Articles