获取上月第一天

来源:互联网 发布:hadoop 8485端口 编辑:程序博客网 时间:2024/05/16 08:10
获取上月第一天

//====================================================================
// 函数: f_last_month
//--------------------------------------------------------------------
// 描述: 获取上月第一天
//--------------------------------------------------------------------
// 参数:
//  datetime ad_date 
//--------------------------------------------------------------------
// 返回值:  datetime
//--------------------------------------------------------------------
// 作者: xx 日期: 2006.07.25
//--------------------------------------------------------------------
// 修改历史:
// 
//====================================================================


Int li_year,li_month
DateTime ld_date
li_year = Integer(String(ad_date,'yyyy'))
li_month = Integer(String(ad_date,'mm'))

If li_month = 1 Then
 li_year = li_year -1
 li_month = 12
Else
 li_month = li_month -1
End If
ld_date = DateTime(Date(String(li_year,'0000')+'/'+String(li_month,'00')+'/01'),Time('00:00:00'))
Return ld_date


 
原创粉丝点击