Dim d As Date d = CDate ({Orders.Order Date}) Dim dr As Date Range dr = DateSerial (Year(d), Month(d) - 1, 1) To _ DateSerial (Year(d), Month(d), 1 - 1) 'At this point dr is the Date Range value holding 'the last full month before {Orders.Order Date}
Crystal 语法示例
Local DateVar d := CDate ({Orders.Order Date}); Local DateVar Range dr; dr := DateSerial (Year(d), Month(d) - 1, 1) To DateSerial (Year(d), Month(d), 1 - 1); //At this point dr is the Date Range value holding //the last full month before {Orders.Order Date}