Re: Shortest possible one-liner to get number of days in a month

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yeah, I didn't test it, I just wrote it in the email. I basically just got
rid of the string manipulation, I should have used Date serial (as I believe
Mike did later in the email), and had I done it in the IDE, I would have
quickly realized my mistake. It is just such a simple thing to do in VB
that I didn't put the thought into it that I should have. Of course I was
on my way out to see Bourne Ultimatum, so my mind was even less on the task
at hand ;-) (pretty good show, except for the jumpy camera....)

Sorry it didn't work out for you.
Lance


"Kjell" <Kjell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:71E51AFC-702B-47F9-990B-A6B000691C58@xxxxxxxxxxxxxxxx
hmmmm, are you sure now....??


lets test it..
someDate = "2007-08-04"
q = Day(DateAdd("m", 1, someDate) - 1)
q is now 3

August has 31 days

sorry, but that's not what I was asking for

Kjell


"Lance Wynn" wrote:

q = Day(DateAdd("m", 1, somedate) - 1)

"Kjell" <Kjell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:599F8675-4C4F-446B-B36A-2A3BED84C4B4@xxxxxxxxxxxxxxxx
This is something I need from time to time; The number of days for the
month
in X,
given that X Is a date variable of course.

X = SomeDate '(from the history or future)

Q = shortest One-liner to get total number of days in the month given
by X

This is my best so far
Q = Day(DateAdd("d", -1, CDate(Format(DateAdd("m", 1, X),
"yyyy-mm-01"))))


Kjell





.



Relevant Pages

  • Re: Papeldumb **MUST** GO!
    ... Yeah, get rid of him--Riveradum must go, too! ... Paps leads the league in blown saves! ... thing to overlook. ...
    (alt.sports.baseball.bos-redsox)
  • Re: Win 7 problems
    ... Yeah, ... I really *hate* that the first thing I find myself doing when faced ... or relative has bought and wants help with) is get rid of some sub- ... standard AV package, MS Office trial edition, and a cartload of other ...
    (uk.comp.homebuilt)
  • Re: Ping Beck
    ... I thought you got rid of Tiger Woods a few weeks ago... ... Yeah i did but my mate lost a bet to me so he just gave me his copy :-)... ...
    (uk.games.video.xbox)
  • Re: Arsene Wenger Begins Mind Games With His Teams Fans
    ... Milan got rid of Kaka' for the same reason they got rid of Shevchenko - ... they were made stupid offers for players who showed signs of breaking ... heard of when it's clear the team needs more experience and especially ... Yeah, yeah, yeah. ...
    (rec.sport.soccer)