Welcome, Guest
Username: Password: Remember me

TOPIC: datetimeto return value?

datetimeto return value? 5 months 1 week ago #1470

  • arifcorp
  • arifcorp's Avatar
  • Offline
  • Junior Member
  • Posts: 30
  • Karma: 0
Hi
I did simple test to check on the datetime functions.

string strcurdate = currentdatetime("YYYY-MM-dd HH:mm:ss");
long longcurdate = datetimeto("YYYY-MM-dd HH:mm:ss", strcurdate);
string strdate = datetimefrom("YYYY-MM-dd HH:mm:ss", longcurdate);

Tags.strDate =strdate;

Somehow, the strcurdate and strdate has about 6 months differences. It should be the same.

FYI, use TeslaSCADA2 ver 2.42 IDE

Let me know if anything wrong on site

Thanks
Last Edit: 5 months 1 week ago by arifcorp.
The administrator has disabled public write access.

datetimeto return value? 5 months 1 week ago #1471

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 534
  • Thank you received: 73
  • Karma: -112
Hello,

Sorry there is a mistake in our user-manual. You should use little "yyyy" instead of "YYYY" in the year definition format.
You code should look like this:
string strcurdate = currentdatetime("yyyy-MM-dd HH:mm:ss");
long longcurdate = datetimeto("yyyy-MM-dd HH:mm:ss", strcurdate);
string strdate = datetimefrom("yyyy-MM-dd HH:mm:ss", longcurdate);

Best regards,
Ruslan
The administrator has disabled public write access.

datetimeto return value? 5 months 1 week ago #1475

  • arifcorp
  • arifcorp's Avatar
  • Offline
  • Junior Member
  • Posts: 30
  • Karma: 0
Thanks
The administrator has disabled public write access.
Go to top