Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. Decode Date

Decode date

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 luc , 4 November, 2015

Hi,

I read a data of type date with following methods :

Read("1.0.1.6.0.255", ObjectType.ExtendedRegister, 5);

public object Read(string logicalName, ObjectType objectType, int attributeIndex)
{
byte[] reply = ReadDataBlock(Client.Read(logicalName, objectType, attributeIndex)[0]);
return Client.GetValue(reply);
}

I know that the result is a date, but answer is an array of byte[] :
{ 0x07, 0xDF, 0x0A, 0x1C, 0x03, 0x10, 0x07, 0x00, 0x00, 0xFF, 0x88, 0x00 }

I didn't found any method to convert this array in date, do you have a method to do that ?

Thanks

luc

10 years 7 months ago

Two ways : - Use static

Two ways :

- Use static ChangeType method

if (val is byte[])
{
val = GXDLMSClient.ChangeType((byte[])val, DataType.DateTime);
// => Give a Gurux.DLMS.GXDateTime

}

- Read a GXDLMSObject instead of use LN, objectType and attribute index :

var dlmsObject = GXDLMSClient.CreateObject(ObjectType.ExtendedRegister);
dlmsObject.LogicalName = "1.0.1.6.0.255";
dlmsObject.SetDataType(5, DataType.DateTime);
val = Read(dlmsObject, 5); // => Give a datetime

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 06/15/2026 - 08:52
    gurux.dlms.c 9.0.2606.1501
  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin