# Wrong datetime computing?

MQL5 Cloud Network speeds up calculations. Try it!
636
2013.12.07 17:42

There are  376565 days between 1970.01.01 00:00:00 and 3000.12.31 23:59:59. so the number of seconds is 376565*24*60*60-1=32535215999.

but computing in MQL5,

```   datetime AA=D'3000.12.31 23:59:59';
printf(TimeToString(AA,TIME_DATE|TIME_SECONDS));
printf("%u",AA);```

The output result is:

2013.12.08 00:32:05.924    aaa (EURUSD,M5)    2470444927
2013.12.08 00:32:05.924    aaa (EURUSD,M5)    3000.12.31 23:59:59

Moderator
30737
2013.12.07 18:18
kwang1:

There are  376565 days between 1970.01.01 00:00:00 and 3000.12.31 23:59:59. so the number of seconds is 376565*24*60*60-1=32535215999.

but computing in MQL5,

The output result is:

2013.12.08 00:32:05.924    aaa (EURUSD,M5)    2470444927
2013.12.08 00:32:05.924    aaa (EURUSD,M5)    3000.12.31 23:59:59

Why are you thinking datetime is an unsigned int ? Documentation said it's an 8 bytes value, so it's a long not an int.

```   printf("As number of seconds %llu",AA);
```

Result:

2013.12.07 18:14:07    Test (EURUSD,H1)    As number of seconds 32535215999

Moderator
18001
2013.12.07 18:28
kwang1:

There are  376565 days between 1970.01.01 00:00:00 and 3000.12.31 23:59:59. so the number of seconds is 376565*24*60*60-1=32535215999.

but computing in MQL5,

The output result is:

2013.12.08 00:32:05.924    aaa (EURUSD,M5)    2470444927
2013.12.08 00:32:05.924    aaa (EURUSD,M5)    3000.12.31 23:59:59

Try . . .

`printf("%I64",AA);`

. . . for an unsigned long

Moderator
30737
2013.12.07 19:08
RaptorUK:

Try . . .

. . . for an unsigned long

• "%I64" isn't a valid format. See documentation.
• I64 isn't specific to unsigned, it's available for signed also.
• You have to use "%I64u" or "%llu" as I previously posted.
636
2013.12.08 02:38
Thank you very much.....