#garfield | Logs for 2016-09-18

Back
[16:24:30] <Tom_itx> gawd i like my newish pc. it boots faster than my old dos pc and that's saying something for windoes
[19:40:03] <Tom_itx> rue_house how would you determine the last day in a given month in code?
[19:40:12] <Tom_itx> say python or whatever you like
[19:40:34] <Tom_itx> also first day
[19:40:48] <Tom_itx> BOM(), EOM()
[19:41:03] <Tom_itx> number wise 1 is always the BOM()
[19:41:26] <Tom_itx> i'm not as concerned about leap years
[19:44:57] <Tom_itx> i suppose you could calculate from first day of the next month -1
[19:47:34] <Tom_itx> actually i think that's what i'm doing
[19:47:43] <Tom_itx> it's just been so long since i looked at it
[19:48:36] <Tom_L> FUNCTION LASTDAY(Date) // returns the last day of that month
[19:48:37] <Tom_L> DEFAULT Date to DATE()
[19:48:42] <Tom_L> IF VALTYPE(date) == "C"
[19:48:44] <Tom_L> Date := CTOD(Date)
[19:48:46] <Tom_L> ENDIF
[19:49:12] <Tom_itx> oops, it didn't all post
[19:49:24] <Tom_itx> must be char irc doesn't like
[19:50:15] <Tom_L> FUNCTION LASTDAY(Date) // returns the last day of that month
[19:50:17] <Tom_L> DEFAULT Date to DATE()
[19:50:21] <Tom_L> IF VALTYPE(date) == "C"
[19:50:23] <Tom_L> Date := CTOD(Date)
[19:50:24] <Tom_L> ENDIF
[19:50:26] <Tom_L> RETURN ( IF(MONTH(Date) = 12,;
[19:50:28] <Tom_L> (CTOD("01/01/"+ RIGHT(STR(YEAR(date)+1),2)) -1),;
[19:50:31] <Tom_L> (CTOD(STR(MONTH(date)+1) +"/01/"+ RIGHT(STR(YEAR(date)),2)) -1) ) )
[20:11:40] <Tom_itx> mmm seems to work with leapyears too