_mkgmtime64 failure in convert()

_mkgmtime64 failure in convert()

jarek_o
Not applicable
332 Views
3 Replies
Message 1 of 4

_mkgmtime64 failure in convert()

jarek_o
Not applicable

Hi everyone,

When I try this:

return convert("di 17 nov 1964",DATE_STR,XL_DATETIME);

in the scripter I get the error:

exception: Invalid convert command: _mkgmtime64 failure

the image is broken, but where exactly does it go wrong?

I get the same error when trying similar examples..

Accepted solutions (1)
333 Views
3 Replies
Replies (3)
Message 2 of 4

SCHamoen
Advisor
Advisor
Accepted solution

@Jarek O I think there are a few issues. First if you are using the weekday abbreviations there have to be 3 characters and I think they have to be the English version (so in this case "Tue" from Tuesday and not "Din" from Dinsdag). Also the weekday name and the month name have to start with capitals (so "Nov" and not "nov") and finally apparently the function only works with times after 1-1-1970 which is the Unix base time. Although Excel can deal with dates starting from 1-1-1900 a lot of other functions are based on the Unix base time so I guess that is a limitation.

So

return convert("Tue 17 Nov 1970", DATE_STR, XL_DATETIME);

works fine and gives 25889

Message 3 of 4

jarek_o
Not applicable

Thank you, I have another question on this.

Unix base time gives the time format as "11:45:32" for example.

If I want to convert this to XL_DATETIME it throws not valid time string.

string b = "10:48:00";
return convert(b, TIME_STR, XL_DATETIME);

What did I do wrong?

0 Likes
Message 4 of 4

SCHamoen
Advisor
Advisor

@Jarek O I forgot to mention but the strings have to match the time and date format settings that can be found under Edit->Model Settings. And there you can see that the time needs either and AM or PM after the h:mm:ss. So you can either add those to your string or change the format to match your string.