I made a simple complain management system in VB.NET, but I want to display daily, weekly, monthly and annual reports at any time when it will be required. The only hardness I'm suffering here is to get let's say the specific date just after the past 24hrs, past 7 days or 30 days

So can any one help me guys?
Even to get a sample of piece of codes to do that?

Thanks

Recommended Answers

All 6 Replies

Yes My friend and here below is my sample codes but I don't know how to proceed from here

Private Sub getDifference()
        Dim firstDate As Date = CDate(DateTimePicker1.Text)
        Dim secondDate As Date = CDate(DateTimePicker2.Text)
        Dim mydif As Integer
        mydif = DateDiff(DateInterval.Hour, firstDate, secondDate)
        lbDisplay.Text = mydif
    End Sub

I should rewrite lines 2 and 3 of your code as : Dim firstDate As Date = DateTimePicker1.Value
A DateTime substraction operator will give you back a TimeSpan structure. Use this further in some if else if decision code.

commented: Thank you so much, I appreciate you +2

I should rewrite lines 2 and 3 of your code as : Dim firstDate As Date = DateTimePicker1.Value . A DateTime substraction operator will give you back a TimeSpan structure. Use this further in some if else if decision code.

Can you show me some more trick please? Because I tried but still didn't work my friend

I should rewrite lines 2 and 3 of your code as : Dim firstDate As Date = DateTimePicker1.ValueA DateTime substraction operator will give you back a TimeSpan structure. Use this further in some if else if decision code.

Great thanks my friend I catch your trick, it work

Thank you so much

If you like to read about some examples on how to use TimeSpan, Click Here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.