HighTechTalks DotNet Forums  

custom date formats

VB.net microsoft.public.dotnet.languages.vb


Discuss custom date formats in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Gordon
 
Posts: n/a

Default custom date formats - 11-07-2006 , 03:18 PM






Hi;

I would like to format a date like this this mmddyy.

I am reading records from a table using the ado.net reader

The dates vary in their length i.e. the day can be either one or two digits
and
the same is true for the month.

I tired the formatDateTime() like :
formatDateTime(rdr2.getvalue(7), dateformat.ShortDate) which yields
mmddyyyy.

The final result that I am looking for is mmddyy.

Do I need a custom date format instead of dateformat.ShortDate ?

Thanks for any insights,
--
Gordon

Reply With Quote
  #2  
Old   
Chris Dunaway
 
Posts: n/a

Default Re: custom date formats - 11-07-2006 , 03:32 PM






Gordon wrote:
Quote:
Hi;

I would like to format a date like this this mmddyy.

I am reading records from a table using the ado.net reader

The dates vary in their length i.e. the day can be either one or two digits
and
the same is true for the month.

I tired the formatDateTime() like :
formatDateTime(rdr2.getvalue(7), dateformat.ShortDate) which yields
mmddyyyy.


The final result that I am looking for is mmddyy.
If you have a DateTime variable, you can use the ToString method to get
the format you want:

Dim strDate As String = DateTime.Now.ToString("MMddyy")

Note the capital M in the format string. Lower case m signifies
"minutes", upper case M signifies month.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.