在datediff()的编码中需要帮助 [英] need help in codeing of datediff()

查看:66
本文介绍了在datediff()的编码中需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我写了下面的代码来查找日期差

Hi all

i wrote the below code to find the date difference

Dim var As String
        var = ds.Tables(0).Rows(0)(0)
        connection.Close()
        Dim time As DateTime = var
        Dim mth As Integer
        mth = DateDiff(DateInterval.Month, DateTime.Now, time)
        If mth <= 6 Then


但我的负数 mth 值是负数.请告诉我我哪里错了

"时间"的值是1/8/2012


but i am getting the "mth" value in negative..please tell me where i am wrong

the value of "time" is 1/8/2012

推荐答案

尝试切换参数:
Try switching the parameters :
mth = DateDiff(DateInterval.Month,  time, DateTime.Now)


这篇关于在datediff()的编码中需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆