Click here to Skip to main content
15,121,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am currently working on a web application. In this I have to display today's sales, weekly sale's and monthly sales. I didn't get the idea to display weekly sales. I want to display both details and chart. Anybody have the idea to get the current weeks details...?

Thank you....
Updated 6-Aug-12 21:05pm
You want to show in Chart or as details?
Neha Thanka 7-Aug-12 1:01am
I have to display in both ways in 2 different pages.

1 solution

if you are asking for getting current week range then below is the function code for getting current week range
// to get First date of week
        public string fDate()
            DayOfWeek weekStart = new DayOfWeek();
            DateTime startdate = DateTime.Today.AddDays(weekStart - DateTime.Today.DayOfWeek);
            string Fdateofweek= startdate.ToShortDateString();
            return Fdateofweek;
        // to get today date
        public string cDate()
            DateTime enddate = DateTime.Today;
            string CurrnetDay =enddate.ToShortDateString();
            return CurrnetDay;

Now Make Sql Query
string query = "select * from tablename WHERE Date BETWEEN '" + fDate() + "' AND '" + cDate() + "'";
Neha Thanka 7-Aug-12 6:26am
Thank you so much.....
Volynsky Alex 8-Aug-12 18:21pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900