Click here to Skip to main content
15,896,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

can any one give me some tips regarding showing

1)monthly report:
It is in which the current month must be taken automatically from the today date and show the result in grid view

2)weekly report:
It is in which the current week by subracting 7 days from today date must be taken automatically and show the result in grid view


the problem is i am using gettype() for datetime function if the user click today den due to the time in it the results not yet displaying in grid view

waiting for ur responces,

thanks in advance




regards,
gowtham
Posted
Updated 26-May-11 21:19pm
v2

1 solution

create a 2 textboxes Date From and Date To and add Search button when click connect it to the databsae send the 2 textboxes as parameter then bind it to your gridview.

1. Monthly Report:
First you need to get the current date the get the 1st day of the month and last day of the month.
here how will you do it.

VB
Dim date_From As DateTime = Now.AddDays((Now.Day - 1) * -1)

Dim date_To As New DateTime(Now.Year, Now.Month, 1)
date_To = date_To.AddMonths(1).AddDays(-1)


2)weekly report:
VB
Dim date_From As DateTime = Date.Now.ToShortDateString()

        Dim date_To As DateTime = Date.Now.AddDays(7)
 
Share this answer
 
v3
Comments
cuteband 27-May-11 3:33am    
show me your code.
gowthammanju 27-May-11 3:42am    
i am using following code to display todays

SELECT * where acdates='"+DateTime.Now.ToShortDateString()+"'"

but in textbox of my aspx code i am using gettype() it inserts values in form of date with current time!

through above code i need split the date and time and show the values at based on this date



using get type() result given as 2011-05-27 13:06:37.793
using datetime() result as 2011-05-27 12:00:00.000

tat y i need to split date from gettype() and insert in to database

gowthammanju 30-May-11 1:21am    
ya thanks,

but i got the solution as

using query we can display as

//below query return current month records

select * from empdt where month(frmdate)=(select month(getdate()))

//Below query show records less than 7 days from today
select * from empdt where frmdate=(getdate()-7)


Above query explanation
* empdt -table name
* frmdate (datetime field) - month (frmdate) return value 1 to 12
* month(getdate()) return current date month
* getdate()-7 return less than 7 days from today
cuteband 27-May-11 4:26am    
please check my solution again

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