ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date format (https://www.excelbanter.com/excel-programming/291517-date-format.html)

Edgar Thoemmes

Date format
 
I am trying to save a file with the date as part of the
file name but the format is wrong. I guess I have to set
the date to a variable and then specify the format but I
dont know how to specify the format. Can anyone help?

Ron Rosenfeld

Date format
 
On Mon, 16 Feb 2004 10:07:36 -0800, "Edgar Thoemmes"
wrote:

I am trying to save a file with the date as part of the
file name but the format is wrong. I guess I have to set
the date to a variable and then specify the format but I
dont know how to specify the format. Can anyone help?



Look at the FORMAT function:


Format Function

Returns a Variant (String) containing an expression formatted according to
instructions contained in a format expression.

so something like:

fnstring = "My Filename"

fnstring = fnstring & FORMAT(DATE,"yyyymmdd")




--ron


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com