Need Secs from DateTimeToStr

Having trouble obtaining Secs from DateTimeToStr function
Screen shot :

code is
DatetimeCombo = DateTimeConvert( 2, DateNum(), TimeNum() );
stimestr = DateTimeToStr( DatetimeCombo[27], 2);

Secs are always 0?

Any help appreciated.

@jadams, what is the interval of your chart when you run the above code?
The "seconds" part result is calculated from the TimeNum() array.

DTBars = DateTimeConvert(2, DateNum(), TimeNum());
DTLastBar = LastValue(DTBars);
_TRACE(DateTimeToStr(DTLastBar, 2)); // this may have the "seconds" as :00 if interval is >= 1 * (60 seconds) (1m, 5m, 15m, 1h, etc.) 

strToday = Now(0);
_TRACE(strToday); // this has the "seconds" part according to the current time
1 Like

I am trying to run tick data. Typical time frame is 15 ticks.
Thanks for asking.

My mistake. I had incorrect format for Date in my database.
I corrected that and now all date variables have seconds.

Thanks for the interest.