PC Review


Reply
Thread Tools Rate Thread

date string needed

 
 
rodchar
Guest
Posts: n/a
 
      21st Oct 2008
hey all,

i'd like a string of today's date in the following format:
mmddyy

and here's how i did it:
String directoryName = DateTime.Now.Month.ToString() +
DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString().Substring(2);

is there an easier way?

thanks,
rodchar

 
Reply With Quote
 
 
 
 
Jeff Johnson
Guest
Posts: n/a
 
      21st Oct 2008
"rodchar" <(E-Mail Removed)> wrote in message
news:408A18F1-7A4B-4A8A-B219-(E-Mail Removed)...

> hey all,
>
> i'd like a string of today's date in the following format:
> mmddyy
>
> and here's how i did it:
> String directoryName = DateTime.Now.Month.ToString() +
> DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString().Substring(2);
>
> is there an easier way?


ToString("MMddyy")

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx


 
Reply With Quote
 
rodchar
Guest
Posts: n/a
 
      21st Oct 2008
thanks for the feedback,
rod.

"Jeff Johnson" wrote:

> "rodchar" <(E-Mail Removed)> wrote in message
> news:408A18F1-7A4B-4A8A-B219-(E-Mail Removed)...
>
> > hey all,
> >
> > i'd like a string of today's date in the following format:
> > mmddyy
> >
> > and here's how i did it:
> > String directoryName = DateTime.Now.Month.ToString() +
> > DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString().Substring(2);
> >
> > is there an easier way?

>
> ToString("MMddyy")
>
> http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
>
>
>

 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      21st Oct 2008
Note that MM differs from mm. MM = month, mm = minute. Someone where I
work hard coded time formats rather than using the system format (no idea
why), but to make things worse he encoded them all hh:ss - so we had what
looked like end times that were before start times :-)



--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed - converting a string to a date. FatMan Microsoft Access VBA Modules 4 24th Feb 2009 08:23 PM
Date string problem in query string when posting back =?Utf-8?B?SnVsaWEgQg==?= Microsoft ASP .NET 5 29th Aug 2007 03:08 PM
String manipulation... help needed in making a string proper Anja Microsoft Access VBA Modules 2 26th Oct 2006 10:15 PM
Date string and Charater string syntax =?Utf-8?B?aWhvbGRlcg==?= Microsoft Access VBA Modules 4 18th Feb 2005 10:09 PM
Using Date Form Field data in Outputto Filename (a date to string chanbge needed)? Rob Oldfield Microsoft Access Form Coding 3 4th Jan 2005 08:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:44 AM.