Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Error Convert Datetime

Error convert datetime

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By mbathe, 23 February, 2022
Forums
Known problems

When I read a date I get a hexadecimal string for example "07E40205030B391200000002" I would like to know how to convert this string into a date in C# and python
the solutions proposed for this same problem do not work for me

Profile picture for user Kurumi

Kurumi

3 years 3 months ago

Hi,

Hi,

You can use GXDLMSClient.ChangeType to convert byte array to date-time.
Something like:

GXDateTime dt = (GXDateTime) GXDLMSClient.ChangeType(YOUR_BYTE_ARRAY_VALUE, DataType.DateTime);

There is an error on the clock status (The last byte in your hex string). The value is 2 and it's not used (reserved) in DMLS standard. Convert works, but that status state is lost.

BR,
Mikko

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/17/2025 - 13:03
    Gurux.DLMS.Python 1.0.182
  • Wed, 06/04/2025 - 13:35
    gurux.dlms.c 9.0.2506.0401
  • Fri, 05/30/2025 - 08:30
    gurux.dlms.c 9.0.2505.3001
  • Tue, 05/27/2025 - 08:10
    Gurux.Serial.Android 2.0.12
  • Mon, 05/26/2025 - 08:39
    gurux.dlms.c 9.0.2505.2601

New forum topics

  • Day profile action item add error (String is not recognized as valid DateTime value)
  • Create gateway protocol in c
  • Error while reading event log object
  • GXDLMS Simulator – AssociationLogicalName Not Listed
  • Failed to read meter through raspberry pi 5 and probe
More

Who's new

  • wanghao-20
  • jin
  • MK_PY_2025
  • sm12345
  • jack 001
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin