Question : now in vb.net 2008

Hi guys

currently writting an app in vb.net 2008 that is creating a csv file with the data that is being collected I have the data going to the csv but am trying to use now to put the date and time into the csv file

outfile.WriteLine("{0:00.00},{1:00.00},{2:00.00}", data1, data2, data3)
        outfile.Flush()
works
outfile.WriteLine("{0:d},{1:00.00},{2:00.00},{3:00.00}", now,data1, data2, data3)
        outfile.Flush()

doesn't work how can I insert into the csv the data and time


Answer : now in vb.net 2008

Use the Now() function to return the current datetime then use .ToString to convert it to text

e.g. Now().toString
You can also  use Now().toString(formatSpecified) to supply a specific format e.g.
Now().toString("dd/MM/YYYY HH:mm:ss")

so, something like
outfile.writeline ("{0},{1}", Now().tostring, "My second field" )
Random Solutions  
 
programming4us programming4us