473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Persian Calendar Class simple conversion problem

Microsoft has introduced a Persian Calendar Class in ASP.net 2.0

http://msdn2.microsoft.com/en-us/lib...ncalendar.aspx

I have looked at the methods and the only way I have managed to convert
a date from Persian to Gregorian or vice versa is to use the getyear,
getmonth and getdayofmonth methods. ie. my code looks something like
this:

'Get gregorian date and return persian date
Function PDate(ByVal g As Date) As Date
Dim pc As New System.Globalization.PersianCalendar
Dim persian As Date
Dim year As Integer = pc.GetYear(g)
Dim month As Integer = pc.GetMonth(g)
Dim day As Integer = pc.GetDayOfMonth(g)
persian = day & "/" & month & "/" & year
persian = CType(persian, Date)
Return persian
End Function
However, I run into a problem for Persian dates such as 31/06/1385
(equivalent to 22/09/2006), where 31 days exist in the 6th month of the
Persian month but not in the Gregorian month. The code refuses to
accept this as a valid date format.

So, I am sure I must be using the wrong approach with this class, i.e.
the wrong methodology for conversions between the Persian and Gregorian
calendar. Could somebody possibly have a look at the class and tell me
what I should be doing instead?

Kind regards,

Steve.

Sep 24 '06 #1
0 2399

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: chennakeshava_ramesh | last post by:
hi, I have a problem, I am not able to find out which day of the week it is using the calendar class. I am using set() function to set the date and want to find out which day i.e mon,tue etc of...
11
by: Faheem Mitha | last post by:
Hi, I'm not sure what would be more appropriate, so I'm ccing it to both alt.comp.lang.learn.c-c++ and comp.lang.python, with followup to alt.comp.lang.learn.c-c++. While working with a...
5
by: ann | last post by:
Does somebody know why I get a blank string in strA? Last time post the wrong code. " Option Strict On Option Explicit On Public Class Cast Private Sub FuncA()
1
by: Michael Tissington | last post by:
I'm trying to convert a project from VS2003 to VS2005 After conversion all of my TagPrefix are not recognized in the body. <%@ Register TagPrefix="Oaklodge" TagName="Curve"...
0
by: egbert.beuker | last post by:
Hi, I encountered a conversion problem in my .net web app (c#), and I hope someone can help me: I'm working on a generic way to store data in a database with a few generated classes. I want...
0
by: ipoxygen | last post by:
Hi, I do have 6 identical tables on six different databases (same server). I would like to merge them into one single table for reporting purposes. For the majority of the table it does work...
2
by: chandan | last post by:
Hi, How to create an instance of user control in a class(simple) file not in Page class file? As I tried I can do it in page class file but not in simple class file. Let me know the solution!! ...
2
by: hostel | last post by:
when we use the calendar class and enter the date in date object as 45/8/2007(dd/mm/yyyy). it will automatically roll forward as 15/9/2007(dd/mm/yyyy) Logically this should not happen as date...
0
by: santhescript01 | last post by:
Unicode to non unicode conversion problem -------------------------------------------------------------------------------- Hi All, I am using C dll in macro which converts Unicode data to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.