|
-
May 31st, 2010, 10:26 AM
#1
Thread Starter
Addicted Member
[RESOLVED] formate in vba code
how do i get this format for example June 7, 2010
MyDate = Format(Now() + 7, "mm/dd/yy")
-
May 31st, 2010, 12:22 PM
#2
Thread Starter
Addicted Member
Re: formate in vba code
still it shows mm/dd/yy
MyDate = Format(Now() + 7, "[$-409]mmmm d, yyyy;@")
-
May 31st, 2010, 12:48 PM
#3
Re: formate in vba code
Kam
Maybe something like this:
Code:
z1 = Now ' 5/31/2010 1:45:32 PM
z2 = Format(z1, "Long Date") ' Monday, May 31, 2010
v1 = Instr(z1, ",")
z3 = Mid(z1, v1 + 1) ' May 31, 2010
Is that what you're looking for?
Spoo
-
May 31st, 2010, 06:17 PM
#4
Re: formate in vba code
You must declare MyDate as String (or Variant), not Date.
Code:
Dim MyDate As String
MyDate = Format(Date + 7, "mmmm d, yyyy")
Debug.Print MyDate '--> June 8, 2010
-
May 31st, 2010, 06:53 PM
#5
Thread Starter
Addicted Member
Re: [RESOLVED] formate in vba code
-
Jun 1st, 2010, 07:16 AM
#6
Re: [RESOLVED] formate in vba code
Kam -- sorry, I completely missed your desire regarding the +7
Anhn -- nice
Spoo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|