In my application i have to show list of working hours by date in a table view,
Here i have 5 scenarios
- Today's projects, working hours
- Selected date projects, hours
- Cureent week (sunday-saturday)
- Current month (working hours in january, February if it is feb march if it is march)
- Current year (all working hours in 2013)
i have implemented sqlite queries as follows,
1. Select Date, ProjectTitle, WorkingHours, sum(WorkingHours) from ProjDetailsTable where date = toDaysDate
2. Select Date, ProjectTitle, WorkingHours, sum(WorkingHours) from ProjDetailsTable where date = selecteDate
I have done for the fist two scenarions
For the 3,4,5 scenarios
3. Select Date, ProjectTitle, WorkingHours, sum(WorkingHours) from ProjDetailsTable where
Date between two Dates
But My problem is if I have the dates
Is there any logic to get the starting for
current week, current month, current year
Note : not the 7 days back, not the 30 months back and not the 365 days back.
My requirement is:
if Current date is Feb-13-2020 WednesDay
This week: Feb-9 to Today
This Month: Feb-1 to Today
This Year: Jan-1-2020 to Today