Re: Last day of the month??
Posted in 1996
Joel Schumacher wrote: > > : let this_day = today > : let day_str = this_day using "mm/dd/yyyy" > > : let mon_int = day_str[1,2] ### get month as integer > : let yr_int = day_str[7,10] ### get year as integer > > : ### first day of this month below > : let day_str = mon_int using "&&", "/01/", yr_int using "&&&&" > : let g_start_date = day_str ### now have 1st of this month as DATE > > Probably a better way to do date manipulations is with the appropriate > functions: > MDY to create a date, given month, day, and year as integers > DAY() to find the day of a date variable > YEAR() to find the year > MONTH() to find the month > > I always felt converting to a string and picking it apart was kind of > a roundabout way of doing things. > > I saw another post that used UNITS addition/subtraction. This is probably > innefficient also as it probably has to convert the dates DATETIME in > order to do the arithmetic. I don't know which is faster but I found that using the datetime conversions you can't ad 1 unit month to January 29(non leap year),30 or 31 because the day of the month does not exist in february. Tom