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

jwcolby jwcolby at colbyconsulting.com
Mon May 5 10:41:31 CDT 2008


When I type

?string.format("yyyyMMdd",Date.Today)

into the debug window I get

yyyyMMdd (the literal string) not 20080505.

What am I doing wrong?

John W. Colby
www.ColbyConsulting.com


jwcolby wrote:
> 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.
> 



More information about the dba-VB mailing list