PC Review


Reply
Thread Tools Rate Thread

Creating new custom calendars

 
 
Arthur Parker
Guest
Posts: n/a
 
      22nd Oct 2008
I have been looking for information on creating new custom calendars; not the
control, but the class that manages dates and date calculations. The only
thing I've been able to find in any of the MS documentation or newsgroups is
that you _can_ derive custom calendars from System.Globablization.Calendar,
but not a word on what you would need to do to accomplish that. Has anyone
ever done or seen any custom calendar implementations? I'd appreciate any
help or pointers on this.
 
Reply With Quote
 
 
 
 
Family Tree Mike
Guest
Posts: n/a
 
      23rd Oct 2008
You may consider looking at extending one of the custom calendars rather
than the abstract Calendar. You then don't need to override so many
methods. For example this class extends GregorianCalendar, making years
relative to 1981.

class ModernCalendar : GregorianCalendar
{
public override int GetYear(DateTime time)
{
return time.Year - 1981;
}
}

Then you could call it via:

static void Main(string[] args)
{
ModernCalendar mc = new ModernCalendar();
GregorianCalendar gc = new GregorianCalendar();

DateTime gcday = new DateTime(2008, 11, 19, gc);
Console.Out.WriteLine(gcday);
DateTime modday = new DateTime(
mc.GetYear(gcday), mc.GetMonth(gcday), mc.GetDayOfMonth(gcday), mc);
Console.Out.WriteLine(modday.ToString());

Console.Out.WriteLine("OK");
Console.In.ReadLine();
}

"Arthur Parker" <(E-Mail Removed)> wrote in message
news:9A91DA93-4136-4CC6-ADCB-(E-Mail Removed)...
>I have been looking for information on creating new custom calendars; not
>the
> control, but the class that manages dates and date calculations. The only
> thing I've been able to find in any of the MS documentation or newsgroups
> is
> that you _can_ derive custom calendars from
> System.Globablization.Calendar,
> but not a word on what you would need to do to accomplish that. Has
> anyone
> ever done or seen any custom calendar implementations? I'd appreciate any
> help or pointers on this.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Creating Custom Calendars Leonid S. Knyshov // SBS Expert Microsoft Outlook Discussion 1 4th Mar 2010 03:54 PM
Creating custom Message Form. Issue with custom Icon Abhishek Tripathi Microsoft Outlook Form Programming 0 1st Dec 2008 11:39 AM
Creating Different Calendars =?Utf-8?B?SmF5RHVTb2xk?= Microsoft Outlook Calendar 1 30th Dec 2005 12:54 AM
Custom Calendars =?Utf-8?B?QWxhaXN0YWlyIEhvd2FyZC1Eb2Jzb24=?= Microsoft Outlook Calendar 1 16th Dec 2005 11:51 AM
Creating Calendars Geek Microsoft Outlook 0 27th Oct 2004 04:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:23 AM.