vba help - date format

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

I want date format like this. 9. Sep 2020 (Month No & "." & Sep & yyyy")

Date formula gives date :=> 12/09/2020 , how to achieve it. thanks for your help in advance.



Thanks
mg
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Could this be what you need
VBA Code:
Format(TheDate,"dd. mmm yyyy"
 
Upvote 0
You want this for today's date? If yes:
VBA Code:
Sub dateFormat()
MsgBox Month(Date) & "." & MonthName(Month(Date), True) & " " & Year(Date)
End Sub
 
Upvote 0
VBA Code:
Format(TheDate,"dd. mmm yyyy"
That is the answer I would have given except I think the OP would only want to use one "d" (based on his posted example) and I am not sure about the space character (his example shows it but his description in parentheses doesn't show it.
 
Upvote 0
Based on description & example, I think the OP doesn't want 'd' at all but more what JoeMo has offered.
I want date format like this. 9. Sep 2020 (Month No & "." & Sep & yyyy")

Date formula gives date :=> 12/09/2020 , how to achieve it. thanks for your help in advance.
So perhaps this?
VBA Code:
Format(TheDate, "m. mmm yyyy")
 
Upvote 0
That is the answer I would have given except I think the OP would only want to use one "d" (based on his posted example) and I am not sure about the space character (his example shows it but his description in parentheses doesn't show it.
Spot on @Rick Rothstein , it should be a "d", I could have sworn that I saw "09 Sep"
 
Upvote 0
Based on description & example, I think the OP doesn't want 'd' at all but more what JoeMo has offered.

So perhaps this?
VBA Code:
Format(TheDate, "m. mmm yyyy")
Very possible. if he didn't mean to type 12. Sep 2020. I guess only the OP can tell us what he really needs
 
Upvote 0
Hi Team,

Thank you all for your help, really helpful. My mistake I didn't put actual requirement clear.

Actual folder structure is :==> 2020\9. Sep 2020\Recon\06.09.2020\abc.xlsx

Through calender user select date , system date dd/mm/yyyy
From above folder structure I have to pick abc file.

a)Year
b)month no, Month Name , Year
c)Recon-----> Constant
d) 06.09.2020 ----> each day folder
e) abc.xlsx actual file.


Thanks
mg
 
Upvote 0
Hi Team,

Thank you all for your help, really helpful. My mistake I didn't put actual requirement clear.

Actual folder structure is :==> 2020\9. Sep 2020\Recon\06.09.2020\abc.xlsx

Through calender user select date , system date dd/mm/yyyy
From above folder structure I have to pick abc file.

a)Year
b)month no, Month Name , Year
c)Recon-----> Constant
d) 06.09.2020 ----> each day folder
e) abc.xlsx actual file.


Thanks
mg
Maybe something like the below, not sure if you need "9.Sep 2020" or "9. Sep 2020" with a space after the Month number
VBA Code:
Format(Date, "yyyy") & "\" & Format(Date, "m. mmm yyyy") & "\Recon\" & Format(Date, "dd.mm.yyyy") & "\abc.xlsx"
 
Upvote 0
Hi Momentman ,Peter_sss, Rick and .JoeMo

Perfect ! Thank you all for your help it worked, learned something new. ?




Thanks
mg
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,241
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top