DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
Go Back  Xtreme Visual Basic Talk > > > DateTimeNow.ToString Format Question


Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2009, 09:40 AM
sanderson sanderson is offline
Junior Contributor
 
Join Date: Feb 2006
Location: Minnesota, USA
Posts: 217
Default DateTimeNow.ToString Format Question


Hi:

I have a program that will copy files from '\SWV' to '\SWV\20090824' - todays date...

It works great, except that todays date is being interpreted as '20093324'. the '3324' portion changes every time, suggesting that it is somehow reading the time or something else instead.

Thanks in advance for the help. It has to be something pretty simple.

Code...

Sub Main()
Dim sourcePath As String = "\SWV"
Dim destPath As String = "\SWV - " + DateTime.Now.ToString("yyyymmdd") + "\"
' Creates 'SWV - 20093324' instead of 'SWV - 20090824'
Console.WriteLine("Vault Backup in Progress...")
RecursiveDirectoryCopy(sourcePath, destPath, True, True)
Console.WriteLine("Vault Backup Complete")


End Sub
Reply With Quote
  #2  
Old 08-24-2009, 11:12 AM
AtmaWeapon's Avatar
AtmaWeaponDateTimeNow.ToString Format Question AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

If you peek at the Custom Date and Time Format Strings, you'll see that "mm" stands for the minute. You're looking for MM, the month from 01 to 12.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
 
DateTimeNow.ToString Format Question
DateTimeNow.ToString Format Question
 
-->