hi, in recent update of gurux , It can't Parse Persian date Correctly . in previous versions ,it was working greatly.
it has error on C# version and GxDlmsDirector.
Packet examples :
TX: 7E A0 1C 00 02 76 71 03 54 A8 19 E6 E6 00 C0 01 C1 00 08 00 00 01 00 00 FF 02 00 60 1A 7E
13:49:30
RX: 7E A0 21 03 00 02 76 71 74 82 BD E6 E7 00 C4 01 C1 00 09 0C 05 7A 02 1F 07 0D 31 17 00 FF 2E 00 62 F2 7E
now it gives Error :
Year, Month and day parameters describe an un-representable DateTime.
at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
at System.DateTime..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second, Int32 millisecond)
at Gurux.DLMS.Internal.GXCommon.GetDateTime(GXDLMSSettings settings, GXByteBuffer buff, GXDataInfo info)
at Gurux.DLMS.Internal.GXCommon.GetData(GXDLMSSettings settings, GXByteBuffer data, GXDataInfo info)
at Gurux.DLMS.GXDLMSClient.ChangeType(GXByteBuffer value, DataType type, Boolean useUtc)
I think the problem raises…
I think the problem raises for month with 31 days . for example in above packets, in Persian 2nd month have 31 days and raises error. but other dates works greatly.
do you have any Idea, what we can do or is there anything that you can change in code ?
I you can add Calendar to…
If you can add Calendar to GXDLMSSettings class and use below constructor of DateTime :
public DateTime(int year, int month, int day, int hour, int minute, int second, Calendar calendar)
that has calendar in in Conversion, I think all the problems will be solved
Hi, No changes have been…
Hi,
No changes have been made to the date and time for a long time. Application is using the default calendar when the date-time is read from the meter.
The date is Yekshanbeh: 31. Ordibehesht 1402. Is that correct?
What is your time zone?
BR,
Mikko
Yes, it.'s correct date…
Yes, it.'s correct date.
Timezome is : +3:30 Tehran
Is there any way to change calendar (set) for this?
Hi, Calendar settings are…
Hi,
Calendar settings are defined in Windows and correct settings are given as a parameter. You can try to change settings from the Windows regional settings.
Are you using Windows 10 or 11? The same environment is installed and I believe that this can be fixed if it can be repeated.
BR,
Mikko
No we are using windows…
No we are using windows server 2012, and I need to set gurux calendar from code. Setting current thread culture also don't slove the problem.
Any ideas will be appreciated.
hi, Is it possible for you…
hi,
Is it possible for you to use DateTime overloads with calendar input in GxCommon ?
I mean use :
new DateTime(year, month, day, hours, minutes, seconds, milliseconds,Thread.CurrentThread.CurrentCulture.Calendar)
instead of :
new DateTime(year, month, day, hours, minutes, seconds, milliseconds)
or :
new DateTime(year, month, day, hours, minutes, seconds, milliseconds, Thread.CurrentThread.CurrentCulture.Calendar, DateTimeKind.Local)
instead of :
new DateTime(year, month, day, hours, minutes, seconds, milliseconds, DateTimeKind.Local)
Hi, This doesn't help when…
Hi,
This doesn't help when you are reading data from the meter because it's not possible to set the calendar for the GXDLMSClient.
If you run dotnet --version what is the output?
BR,
Mikko
there is no need to set…
there is no need to set calendar for the GXDLMSClient. we can use custume Culture class that has calendar as needed, and set for thread culture. but because you use this overloads of "new DateTime" that does not have Calendar in there inputs,then .net does not use thread calendar for them.
dotnet --version
7.0.203
In changed the code as said…
In changed the code as I said above, and the code worked greatly
hi, I'm sorry, did you find…
hi,
I'm sorry, did you find any solution for this problem ? or have any idea ?
Hi, I would like to know if…
Hi, I would like to know if you plan on implementing the changes I suggested in GxCommon. I would appreciate it if you could let me know.
I believe that changing the method as I proposed will not have any side effects on your code, since there is no calendar setting in GXDLMSClient. Therefore, your code uses the system's default calendar. Changing the code as follows:
new DateTime(year, month, day, hours, minutes, seconds, milliseconds, Thread.CurrentThread.CurrentCulture.Calendar)
instead of:
new DateTime(year, month, day, hours, minutes, seconds, milliseconds)
in GxCommon should be fine. If you have any comments on this, I would appreciate your feedback.
If this change is applied to the source version, I would be able to use your later updates more easily. Thank you in advance!
Hi, Sorry to say, but it's…
Hi,
Sorry to say, but it's not s simple. This needs a lot of testing before it can be released.
Different time zones and localizations might cause really nasty problems.
It seems to work and it should be on the next release, but I can't say anything for sure before the tests are over.
BR,
Mikko
Thank you. I would…
Thank you.
I would appreciate it if you could let me know the result.
Hi, This can be added for…
Hi,
This can be added for the next release. It's released during the next week.
BR,
Mikko
Hi, thank you in advance.
Hi, thank you in advance.
Hi, This is improved for the…
Hi,
This is improved for the GXDLMSDirector version 9.0.2306.0201.
BR,
Mikko