By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,483 Members | 1,711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,483 IT Pros & Developers. It's quick & easy.

First and Last Day of actual Month

P: 2
Is there a function to get the first and the last day of the actual month?

Regards
4vTurbo
Dec 15 '11 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,421
The first day of a month is always the same. For the last day, you can take the first day of the next month and subtract a day.
Dec 15 '11 #2

NeoPa
Expert Mod 15k+
P: 31,709
For the first day you can format a string starting with "1/" (or including "/1/" if American) and converting that to a date, or you can use the Day() and DateAdd() functions to move to the correct date :

Expand|Select|Wrap|Line Numbers
  1. CDate(Format(Date(), "m/1/yyyy"))
  2. DateAdd("d", 1 - Day(Date()), Date())
For the last day you would go back one day from the first of next month :

Expand|Select|Wrap|Line Numbers
  1. DateAdd("d", -1, CDate(Format(DateAdd("m", 1, Date()), "m/1/yyyy")))
Dec 16 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.