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. Node
  3. DateTime epoch conversion

DateTime epoch conversion

By Bhaumik, 26 September, 2023
Forums
Gurux.DLMS

Hi Mikko,

We have extracted the block load profile data and acquired the accurate date and time for 15-minute block intervals in GXDLMDirector. For example:

26/09/2023 00:15:00
26/09/2023 00:30:00

However, when utilizing the ToUnixTime function from the GXDateTime object to convert time to epoch and back to regular time, we are encountering the following discrepancies:

DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc);
return Convert.ToInt64((date.ToUniversalTime() - dateTime).TotalSeconds);

26/09/2023 00:14:59
26/09/2023 00:29:59

Could you kindly provide your recommendations on how we can obtain the correct datetime from epoch in DLMS? and which one is correct ?

Profile picture for user Kurumi

Kurumi

2 months 1 week ago

Hi, The correct EPOC time is…

Hi,

The correct EPOC time is this.

DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

You need to change seconds from 1 to zero.

BR,
Mikko

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

Hire Us!

Latest Releases

Thu, 11/30/2023 - 14:45
Gurux.DLMS.Python 1.0.147
Wed, 11/29/2023 - 13:03
gurux.dlms.c 20231129.1
Tue, 11/21/2023 - 09:55
Gurux.DLMS.AMI4 4.0.2311.2101
Tue, 11/21/2023 - 09:41
Gurux.DLMS.Net 9.0.2311.2101
Thu, 11/16/2023 - 08:52
gurux.dlms.c 20231116.1

Open bugs

gurux.dlms.c
4
gurux.dlms.cpp
3
gurux.dlms.delphi
1

New forum topics

  • change version of Auto Answer object
  • "Service not allowed. Operation not possible" Error on Gurux.DLMS.Python
  • [Gurux DLMS for C] Error in "loadSettings" function located in "svr_InitObjects" function
  • Power Meter Integration Using DLMS Protocol
  • [Gurux DLMS for C] Problem writing to an attribute of type 'array'
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin