Time Digits

 

Working on a Market Hours Indicator and run into a simple but annoying problem. Example...

New York time is 12:05 however when displaying on the chart, 12:5 is displayed.

How does one make sure hours, minutes and seconds always display with 2 Digits. 12:05:05

Thanks!

 

Print( "Here it is " + TimeToString( 43505, TIME_SECONDS)

Output:

2008.01.09 23:14:19 Tool EURJPY,M5: Here it is 12:05:00

 

Legend phy...

Can you have a look at this issue?

Heres a function to display Market Hours on the chart...

void SetObject(string a_name, string a_text, color a_text_color, int a_corner_value, int a_xdistance_value, int a_ydistance_value) {
   ObjectCreate("a_name",OBJ_LABEL, 0, 0, 0);
   ObjectSetText("a_name", a_text, 10, "Verdana", a_text_color);
   ObjectSet("a_name", OBJPROP_CORNER, a_corner_value);
   ObjectSet("a_name", OBJPROP_XDISTANCE, a_xdistance_value);
   ObjectSet("a_name", OBJPROP_YDISTANCE, a_ydistance_value);

Execute function...

   SetObject("FX Assistant", l_fx_assistant, Silver, 0, 990, 5);
   SetObject("UTC/GMT", l_utcgmt, Silver, 0, 990, 20);
   SetObject("Broker Time", l_server_time, Silver, 0, 990, 35);
Problem is it only displays the last SetObject code on the chart. All previous SetObjects are removed.
 

Take the quotes off "a_name"

 

Yep that will do it.

And here is that been I owe you... Cheers!