Here are some useful code items and examples for Microsoft Visual C#.
C# Format Now date and time stamp equivalent to VB.NET
Posted: Mon Sep 19, 2005 10:32 am
BB
Regular
Joined: Jun 23, 2004
Posts: 340
In Visual Basic .NET one carryover in the Now statement that gets a DateTime object with the current date and time. It is very useful to use this information as a string for log file time stamps and unique file names.
Here is an example where I wanted to create a unique text file called Group29Log.txt for each day. So if today were February 5th, 2005, the file name might look like this:
Group29Log20050205.txt
In Visual Basic .NET, the code looks like this:
Code:
Dim filename As String
filename = "Group29Log" & Format(Now, "yyyyMMdd") & ".txt"
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.
You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php