Incomplete implementation of StrToTime()

 
Incomplete implementation of StrToTime()

(1) The following MT4 command does not work:

var1 = StrToTime("2003.8.12"); // returns with current time

(a) I am using StrToTime in the following MT4 function:

int Now() // Creates current PC DateTime
{
int iNow;
string sNow;
//Need to format as "yyyy.mm.dd hh:mi"

//Create a temporary value=Today's date, midnight
iNow=StrToTime("00:01");

//Creates a Date string without Time
sNow=TimeYear(iNow)+"."+TimeMonth(iNow)+"."+TimeDay(iNow);

//Create the full DateTime value that includes time
iNow=StrToTime(sNow);

return(iNow);
}

The above code correctly returns yyyy.mm.dd but returns hh:mm as 00:00


(b) My original MT3 function works in MT3:

/*[[
Name := Now
Author := Paul Y. Shimada
Link := PaulYShimada@Yahoo.com
Notes := Creates a numerical value that gives the current DateTime
]]*/

Variables:
Now(0),
s_Now(""),
;
//Need to format as "yyyy.mm.dd hh:mi"

//Create a temporary value=Today's date, midnight
Now=StrToTime("0:00");

//Creates a Date string without Time
s_Now=TimeYear(Now)+"."+TimeMonth(Now)+"."+TimeDay(Now);

//Create the full DateTime value
Now=StrToTime(s_Now);

Return(Now);


Thanks for your attention MetaQuotes.

Regards,
Paul Y. Shimada, PaulYShimada@Yahoo.com
 
Hi,

I noticed that your 'iNow' variable is of type int - doesn't StrToTime() return 'datetime' type variables? I don't know if it'll make any difference but it might be worth a shot....
 
I had tried all combinations of Now() and iNow versus int and datetime. That is when I discovered that StrToTime correctly returns yyyy.mm.dd but does NOT return hh:mm at all--hh:mm is always returned as 00:00. By the way, I believe that type datetime is same as integer.

Dear MetaQuotes,

How Many bytes &/or bits for each of MT4 data types: double, integer, logical, color, datetime? Does MT4 have separate long integer and signed integer types?

Thanks,
Paul Y. Shimada
 
I had tried all combinations of Now() and iNow versus int and datetime. That is when I discovered that StrToTime correctly returns yyyy.mm.dd but does NOT return hh:mm at all--hh:mm is always returned as 00:00. By the way, I believe that type datetime is same as integer.

Dear MetaQuotes,

How Many bytes &/or bits for each of MT4 data types: double, integer, logical, color, datetime? Does MT4 have separate long integer and signed integer types?

Thanks,
Paul Y. Shimada
 
I had tried all combinations of Now() and iNow versus int and datetime. That is when I discovered that StrToTime correctly returns yyyy.mm.dd but does NOT return hh:mm at all--hh:mm is always returned as 00:00. By the way, I believe that type datetime is same as integer.

Dear MetaQuotes,

How Many bytes &/or bits for each of MT4 data types: double, integer, logical, color, datetime? Does MT4 have separate long integer and signed integer types?

Thanks,
Paul Y. Shimada
 
about StrToTime - we've fixed descriptions in the dictionary in accordance with implementation
about data types see "Data Types"
double is 8 bytes long
bool, color and datetime are integers and are 4 bytes long
Reason: