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

4 years 1 month 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

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 04/07/2026 - 17:17
    Gurux.DLMS.Python 1.0.197
  • Tue, 04/07/2026 - 15:03
    gurux.dlms.c 9.0.2604.0701
  • Tue, 04/07/2026 - 14:50
    gurux.dlms.java 4.0.91
  • Tue, 04/07/2026 - 14:00
    Gurux.DLMS.Net 9.0.2604.0701
  • Mon, 03/30/2026 - 15:39
    gurux.dlms.c 9.0.2603.3001

New forum topics

  • Issue when reading Itron Type620 meter
  • Handling Unexpected Disconnects
  • DLMS Communication Issue – No Response (L&T Meter via USB Probe)
  • Unable to cast object of type Gurux.DLMS.GXStructure to type Gurux.DLMS.GXArray
  • How to properly invoke KeyAgreement
More

Who's new

  • ZJT
  • Dragoslav
  • GiuseppeB
  • tepa_pa
  • zeroday-pt
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin