Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Given a date, how to find the beginning date and ending date of that week (http://www.velocityreviews.com/forums/t279054-given-a-date-how-to-find-the-beginning-date-and-ending-date-of-that-week.html)

 Matt 11-08-2003 08:01 PM

Given a date, how to find the beginning date and ending date of that week

Given a date, how to find the beginning date and ending date of that week

 Gianni Mariani 11-08-2003 08:24 PM

Re: Given a date, how to find the beginning date and ending dateof that week

Matt wrote:
> Given a date, how to find the beginning date and ending date of that week
>

if date is an integer corresponding to time in a linear elapsed way then

my_linear_time find_beginning_of_week( my_linear_time t )
{
return ( t + day_of_week_offset ) % time_elapsed_in_week;
}

 Pete Becker 11-08-2003 08:30 PM

Re: Given a date, how to find the beginning date and ending date of thatweek

Matt wrote:
>
> Given a date, how to find the beginning date and ending date of that week
>

Figure out what day of the week it is (read about the header <time.h>).
From there it's easy.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

 All times are GMT. The time now is 04:04 AM.