| |

VerySource

 Forgot password?
 Register
Search
View: 832|Reply: 3

DateDiff problem comparing dates

[Copy link]

4

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-8 12:30:02
| Show all posts |Read mode
I want to compare the size of two dates 20160102 and 20160222, I use
DateDiff ("dd", var_one, var_two) always reports "Type mismatch"
What is the reason, what value should interval be used for?
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-5-30 19:00:01
| Show all posts
var_one and var_two should be numeric values ​​of date type, you can use the cDate function to convert the date string into a date and then call the DateDiff function
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-7 20:15:01
| Show all posts
20160102 and 20160222 are not date formats, so the error is reported

In addition, the dated interval is used as "d"
Reply

Use magic Report

0

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-19 21:45:01
| Show all posts
Cdate() function for type conversion
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list