Date converter for linux

Prasanna Gautam pgautam at ubuntu.org.np
Mon May 19 16:05:23 BST 2008


Nice effort. I had tried to do something like this. Well, I asked some
people but got really lazy to write the database. There needs to be a
database because although the system is inherently mathematical(they use
sun's position in the sky or something), the committee that handles
this, Panchank Nirnayak Samiti, changes the day count and stuff which
makes it almost impossible to have a single rule to do it all nicely.
The only way is to have some sort of database or lookup table.
Tushar Neupaney wrote:
> Dear all,
>
> Thanks for your reply. As per your request here is the code:
>
> // डेट्स नामक स्वरुप बनाएर मितीहरुलाई यस्मै प्रविष्ठ गरिनेछ
>
>     struct Dates
>         {
>             public int year;
>             public int month;
>             public int day;
>             public int dtype;
>         };
>    
>     // मिती परिवर्तन गर्ने मुख्य सुत्र
>
>     public void DateToConvert(int y, int m, int dy, int DateType)
>         {
>
>             // यदि नेपालीमा मिती परिवर्तन गर्नु परेमा
>        
>             if(DateType==1){
>                
>                 y     = y + 56; // विक्रम सम्वतलाई ५६ ले जोड्दा
>                 m     = m + 8;  // महिनामा ८ जोड्दा
>                 dy    = dy + 18; // दिनमा १८ जोड्दा
>
>             }   
>            
>             // यदि अङ्ग्रेजीमा मिती परिवर्तन गर्नुपरेमा
>
>             else if(DateType==2)
>             {
>                 y    = y - 56; // विक्रम सम्वतलाई ५६ ले घटाईँदैछ
>                 m    = m - 8;  // महिनालाई ८ ले घटाईँदैछ
>                 dy    = dy -18; // दिनलाई १८ ले घटाईँदैछ
>
>             }
>
>             if(dy<=0){dy= 30- System.Math.Abs(dy);m= m -1;}
>             if(m<=0){m= 12- System.Math.Abs(m);y= y-1;}
>
>             if(dy>30){dy= 30- dy; m=m+1;}
>             if(m>12){m=12- m; m=System.Math.Abs(m);y= y+1;}
>            
>             m=System.Math.Abs(m); y=System.Math.Abs(y);
> dy=System.Math.Abs(dy);
>
>             // म अब तपाईँहरुलाई प्रतिफल दिँदैछु
>    
>             MessageBox.Show(y + "/" + m + "/" + dy);
>        
>         }
>
>
> Thanks in advance.
>
> This is not the real conversion utility as it gives bias results and I
> don't want to use a database. I need a code? is it possible?
>
> Tushar.
>
>
>
> 2008/5/19 Bibek Shrestha <bibekshrestha at gmail.com
> <mailto:bibekshrestha at gmail.com>>:
>
>     DO you have the code hosted somewhere,
>     is it free software?
>
>
>
>     On Mon, May 19, 2008 at 5:55 PM, rajesh aryal <rajgiant at gmail.com
>     <mailto:rajgiant at gmail.com>> wrote:
>     > no one is talking... tushar bro, maybe put a line of code that is
>     > problametic and someone can look?
>     >
>     >> Dear All,
>     >>
>     >> I need a help. I have developed a date converter (From Nepali
>     to English,
>     >> English to Nepali). I have used Mono (C#) so it works in linux,
>     Mac OSX and
>     >> Windows all at once.
>     >>
>     >> Can anyone help me with the conversion. Some times the results
>     are not what
>     >> I want.
>     >>
>     >> Wishes,
>     >> Tushar.
>     >
>     >> --
>     >> Ubuntu-np mailing list
>     >> Ubuntu-np at lists.ubuntu.com <mailto:Ubuntu-np at lists.ubuntu.com>
>     >> Modify settings or unsubscribe at:
>     https://lists.ubuntu.com/mailman/listinfo/ubuntu-np
>     >
>     >
>     > --
>     > Ubuntu-np mailing list
>     > Ubuntu-np at lists.ubuntu.com <mailto:Ubuntu-np at lists.ubuntu.com>
>     > Modify settings or unsubscribe at:
>     https://lists.ubuntu.com/mailman/listinfo/ubuntu-np
>     >
>
>
>
>     --
>     Bibek Shrestha
>     bibekshrestha at gmail dot com
>     --
>     YoungInnovations Pvt. Ltd.
>     GPO 8976 EPC 241
>     Thamel Kathmandu, Nepal
>
>




More information about the Ubuntu-np mailing list