Welcome, Guest
Username: Password: Remember me

TOPIC: datetimeto return value?

datetimeto return value? 2 years 9 months ago #1470

  • arifcorp
  • arifcorp's Avatar
  • Offline
  • Senior Member
  • Posts: 46
  • 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: 2 years 9 months ago by arifcorp.
The administrator has disabled public write access.

datetimeto return value? 2 years 9 months ago #1471

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 826
  • Thank you received: 123
  • Karma: -107
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? 2 years 9 months ago #1475

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