PDA

View Full Version : [SOLVED:] Date Format



Cinema
10-18-2018, 08:50 AM
Hi,

I want to convert my date into the following format: from dd.01.2018 to --> January 2018

Here is the code


Dim strFormatted As String
Dim Date1 As Date

Date1 =Worksheets("Table1").Cells(1,1).Value ' here is the date given as follows dd.01.2018

strFormatted = Format(Expression:=Date1, Format:="mmm-yy")

This code returns strFormatted as dd.mmm. I dont understand why?

Kenneth Hobs
10-18-2018, 09:42 AM
If you actually have a valid date value in worksheet Table1 cell A1, then the format string would be:

strFormatted = Format(Expression:=Date1, Format:="mmmm yyyy")

Cinema
10-19-2018, 04:50 AM
Hi kenneth thank you.