zero is omitted while converting integer to string - page 2

 
Marco vd Heijden:

Please don't get fooled by people telling you that 'there is only one way'.

In the end all that matters is that your code does what you designed it to do, and that it (hopefully) pay's off.

How you got there is less important then getting there.

There are many many ways to make something work.

If someone claims that there is only one way to the top, it shows a very narrow mindset. 

In stead try all things that you can come up with and pick the one that performs best.

The other attempts will come in handy when you try to solve other problems in the future.

Thank you for inspiring me sir. With your words and your previous help I tried to figure it out what another way I could  try and I did. See I have done the following:  

string currenttime = TimeToString(TimeCurrent())+":00";
   StringReplace(currenttime,".","-");

This gave me result and everything worked fine, thank god.

 
Marco vd Heijden:

Please don't get fooled by people telling you that 'there is only one way'.

In the end all that matters is that your code does what you designed it to do, and that it (hopefully) pay's off.

How you got there is less important then getting there.

There are many many ways to make something work.

If someone claims that there is only one way to the top, it shows a very narrow mindset. 

In stead try all things that you can come up with and pick the one that performs best.

The other attempts will come in handy when you try to solve other problems in the future.

This would be a very inspirational message for many different topics, but here we're discussing computer science theory, and in CS a datetime is a data-type that represents a linear value and a string is an abstract type that represents data in human readable form or an intermediary such as in this case. You wouldn't tell someone to compare numbers by using their string values

if("2" > "1")

so why would you encourage bad form by saying it's perfectly ok to compare a potentially inconsistent string representation of a date? I don't normally agree with whroeder, but he's absolutely correct in this case. If you're comparing numbers (which datetime is) then you first need to convert that string to a number. 

 

I'm not going to bite.

Sorry.