SmiData GetFromDate / GetUntilDate

This example show you how to get the start and end date of a given period using the smidata vipers. Note that for the periods ThisWeek, PreviousWeek and LastWeek, the returned values depend on the setting "FirstDayOfWeek" in SmiServer.exe.config. The example was executed on November 12th 2010 and the results shows that the "FirstDayOfWeek" setting was set to Sunday.

Smartsite SXML CopyCode image Copy Code
This week
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, ThisWeek))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, ThisWeek))}

This month
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, ThisMonth))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, ThisMonth))}
        
Previous week
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, PreviousWeek))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, PreviousWeek))}
    
Previous month 
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, PreviousMonth))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, PreviousMonth))}
    
Last week
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, LastWeek))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, LastWeek))}
    
Last month 
    starts on {locale.formatlongdate(smidata.getfromdate(smi20, LastMonth))}
    ends on {locale.formatlongdate(smidata.getuntildate(smi20, LastMonth))}
Example Result CopyCode image Copy Code
This week
    starts on Sunday, November 07, 2010
    ends on Saturday, November 13, 2010

This month
    starts on Monday, November 01, 2010
    ends on Tuesday, November 30, 2010
        
Previous week
    starts on Sunday, October 31, 2010
    ends on Saturday, November 06, 2010
    
Previous month 
    starts on Friday, October 01, 2010
    ends on Sunday, October 31, 2010
    
Last week
    starts on Saturday, November 06, 2010
    ends on Friday, November 12, 2010
    
Last month 
    starts on Wednesday, October 13, 2010
    ends on Friday, November 12, 2010