[dba-VB] VB.Net Date/time in specific format

Doug Murphy dw-murphy at cox.net
Mon May 5 11:40:43 CDT 2008


Hi John,

I have an app that does something similar with wav files.  What I use to
time stamp the files is to use the time as the file name as follows.

sFileName = sFolder & CStr(DatePart("h", Now)) & "_" & CStr(DatePart("n",
Now)) & "_" & CStr(DatePart("s", Now)) & ".wav"

May not be elegant but it works.

Doug 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Monday, May 05, 2008 8:23 AM
To: VBA
Subject: [dba-VB] VB.Net Date/time in specific format

I need to get the current date / time in a format that does not include
: or /, IOW "20030123-082347".  I need it in this format for appending to a
file name so that the name is unique and sorts in the directory.

Has anyone already done this, or know how it is done?  I can get the year
part etc., but I am not finding hour, minute or second, and I am just
wondering if someone has code already built.

--
John W. Colby
www.ColbyConsulting.com
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list