write date into file in YYYY.MM.DD format

  • Thread starter Thread starter Lars Schouw
  • Start date Start date
L

Lars Schouw

From VBA I want to write a date into a file a file in the format
YYYY.MM.DD
how can I do this?


Lars
 
Thanks Ron,

=TEXT(TODAY(),"yyyy.mm.dd")

seems to do the stunt..

I need this format since some application have depends on it.. I agree
ISO format is much nicer,
 
Look out if you also use Non English systems if you use the Text function

yyyy in the Netherlands is jjjj

English language Version entry:
="Today is "&TEXT(TODAY(),"yyyy-mm-dd")

In English language version the formula returns:
Today is 2005-02-23

Fails when the when workbook is open in Dutch language version (year = jaar "jjjj-mm-dd").
With a Dutch language version the formula will return:
Today is yyyy-02-23
 
Thanks I sometimes have users on Japanese systems.
Is there a nice workaround for that problem ?
Lars
 
Hi Lars

If you do it with VBA it is always working correct

Sub test()
ActiveCell.Value = Format(Date, "yyyy.mm.dd")
End Sub

But not with the worksheetfunction



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


Thanks I sometimes have users on Japanese systems.
Is there a nice workaround for that problem ?
Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top