2

I'm trying to do a Datediff in VB.Net thats confusing me.

Basically I'm trying to do the following.

If DateDiff("D", Today(), rsData("Start")) > 0 Then

This is working fine when comparing the value from SQL with todays date. I however need to convert this to check the current month and if it matches then return whatever I'm trying to show below.

The SQL field format is as follows - 2012-01-03 00:00:00.0000000

Thanks!

3
  • If the SQL column is, correctly, storing the date as a date or datetime, then it doesn't have a format. Commented Jan 3, 2012 at 13:02
  • You want to check if it's the same month? Have you tried DateDiff with DateInterval.Month? I'm not sure if this is a SQL or a VB.NET question. And what is that Today-function? Normally you would use Date.Now to get current datetime. Commented Jan 3, 2012 at 13:04
  • The Today function is a property that just shows todays date - identical I believe to date.now. Commented Jan 3, 2012 at 13:33

1 Answer 1

2
'Is the data's month equal to today's month?
If Today.Month = CDate(rsData("Start")).Month Then

End If
Sign up to request clarification or add additional context in comments.

1 Comment

Good to hear. It would be appreciated if you could accept this as the correct answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.