Solved

Customised Calendar

Posted on 2007-03-23
2
179 Views
Last Modified: 2010-04-14
Hi experts, I would like to build a simple calendar on a seven rows by five columns table. It is used to fill in scheduled items. It is something like the datetimepicker control. I would like to know how to determine the first date so that I can start to fill the "cell".
0
Comment
Question by:novknow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 9

Expert Comment

by:ripahoratiu
ID: 18778895
You mean the first moday date in or out the month of a given date? Let's say you start with a known date: myDateTime (could be DateTime.Now)

            DateTime FirstDateOfMonth = myDateTime.AddDays(1-myDateTime.Day);
// FirstDateOfMonth contains the first date in month. If  you want to find out what's the day of week of
// the first of the month just ask it with FirstDateOfMonth.DayOfWeek
// if you want to complete to the first monday regradless of the start day of the month contineu with:
            DateTime FirstSundayToDisplay = FirstDateOfMonth;
            if (FirstDateOfMonth.DayOfWeek != DayOfWeek.Monday)
            {
                FirstSundayToDisplay = FirstDateOfMonth.AddDays(-(long)(FirstDateOfMonth.DayOfWeek));
            }


That's all...

0
 
LVL 9

Accepted Solution

by:
ripahoratiu earned 500 total points
ID: 18778912
....replace all apearences of word monday with sunday. The first sunday. In Europe the week begins monday :)
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question