Date Object In Visual Studio 2005

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.

Hey guys, I'm having a hard time getting the date object from vb.net 2005 formatted the way I want it, and I think some of the documentation might be wrong.

According to the Microsoft Developer Network, Date.Today() should return the date in yyyy-mm-dd format. It doesn't. The date is does return is in m/d/yyyy format.

Currently to get close to the output I want, I have to string together three separate instances of the date object ala,

CODE
Date.Today.Year() & Date.Today.Month() & Date.Today.Day()

Giving me: yyyymdd. This is almost the format I want. It truncates the leading zeros from month and day. I want those zeros.

I've done some quick searches on MSN, but I can't seem to find too much. I find it hard to believe that Visual Studio 2005 doesn't have a more efficient way of producing and formatting the date object?

Joined: 11/28/2008
User offline. Last seen 38 weeks 6 days ago.
Would PHP work? CODE <?php

Would PHP work?

CODE
<?php echo date("Y-m-d"); ?>

That'd output 2008-01-08

I don't know what Visual Studio is, sorry.

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.
Unfortunately no. The process

Unfortunately no. The process I'm working on is for a windows assembly, and Visual Studio is a tool needed to created such things. (Think .NET)

PHP, ColdFusion, and other various languages have very simple built in instructions to format date output... I find it hard and at the same time easy to believe that Microsoft's language would not have such convenient practices readily available.

Joined: 11/28/2008
User offline. Last seen 3 years 9 weeks ago.
Does this page

Does this page help?

http://www.thescripts.com/forum/thread694746.html

It talks about wrapping a Format() function around it.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.
Ah! That would do it. Thanks

Ah! That would do it. Thanks for the link Paul.