Foxtable(狐表)用户栏目专家坐堂 → 关于计算年龄 EXCEL中=int(2017.02-B1)


  共有1420人关注过本帖树形打印复制链接

主题:关于计算年龄 EXCEL中=int(2017.02-B1)

帅哥哟,离线,有人找我吗?
有点色
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/26 22:58:00 [只看该作者]

If e.DataCol.name = "出生年月" Then
    If e.newvalue <> Nothing Then

        Dim d As Date = New Date(e.newvalue.substring(0,4), e.newvalue.substring(5,2), 1)
        Dim y As Integer = d.year
        If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
            e.DataRow("年龄") = Date.Today.Year - y
        Else
            e.DataRow("年龄") = Date.Today.Year - y -1
        End If
    Else
        e.DataRow("年龄") = Nothing
    End If
End If


 回到顶部
总数 11 上一页 1 2