Products | Versions |
---|---|
Spotfire Analyst | All Versions |
Here is an example custom expression to calculate the number of days in a month:
DateDiff("day", DateAdd("day",(-DayOfMonth([MyDateColumn])) + 1,Date([MyDateColumn])), DateAdd("month",1,DateAdd("day",(-DayOfMonth([MyDateColumn])) + 1,Date([MyDateColumn]))) )
where [MyDateColumn] is your column with a DataType of Date or DateTime for which you want to calculate how many days are in that month.
Additionally, this expression used included in the above expression is useful for finding the first day of a given month:
DateAdd("day",(-DayOfMonth([MyDateColumn])) + 1,Date([MyDateColumn]))
Doc: TIBCO Spotfire Professional User's Guide > Date and Time Functions