Question: I am trying to find the difference of expenses of previous and current month in sql.

I have a table like this

```
Date       Amount Category
2/18/2015  100    Salary 
2/12/2015  150    Rent
2/21/2015  200    Allowances
1/4/2015   200    Salary
1/17/2015  50     Rent
1/20/2015  100    Allowances

```

Now I want a result like this

```
Category    CurrentMonthAmount PreviousMonthAmount Difference

Salary      100                200                 100
Rent        150                50                  100
Allowances  200                100                 100

```

Answer: 
You can use something like below on the Calender Click Method:

```
DateTime date = Convert.ToDateTime(calendar.SelectedDate.ToString());

```

Here calendar is the ID of your calendar control! 

Hope this helps.
Because it'is a web application i could just use JQuery UI
<http://jqueryui.com/datepicker/#inline> 

```
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display inline</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
   $( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<form runat="server" id="form1">
    Date: <div id="datepicker"></div>
</form>
</body>
</html>

```

Here is a full API description <http://api.jqueryui.com/datepicker/>
May be this can help you as an alternative to do this also !\

There is also an Ajax library for .NET. you can try also: <http://www.codeproject.com/Tips/407460/How-to-use-ASP-NET-AJAX-Calender-Extender>