time conversion

  
I had a strange problem with downloading files. The user wanted to have the date and time in the filename that is supplied to the browser. So part of the file name generation was : Substr(TimeToText(CurrTime()),0,5) (i don't need the seconds). But the filename that was given while downloading didn't look very good .. In the end I suspected the browser changing the supplied name to make it valid for the file system and that was right, i used a text box to check the string generated.
Now I changed the time part to : Replace(Substr(TimeToText(CurrTime()),0,5),":","-")
This took me a long time because of the browser doing unexpected things .. :-)
Just wanted to give a small tip here :-)

regards,
Wim
Hi Wim,

I would suggest something to simplify what your doing with "Replace(Substr(TimeToText(CurrTime()),0,5),":","-")" to get the hour and minute, which would be:
Hour(CurrDateTime())+":"+Minute(CurrDateTime())

Cheers,
Hermínio Mira
Hi Herminio,

Hmm .. indeed an option, downside is that the numbers will have no zero's in front I think..

regards,
Wim
Hi Wim,

You can also use the FormatTime built-in action http://www.outsystems.com/help/servicestudio/5.0/Language_Reference/Built_in_Functions/Formatting_functions/FormatTime_Function.htm

You may use it with the CurrTime() built-in action as well.

Cheers,
André
André,

I think he might not have used that one because he doesn't need the seconds.

Cheers,
Hermínio Mira

And i'm still on 4.2 maybe it's a new 5.0 function ?

Wim
CurrTime() was already available in 4.2 as built-in action()

I was more thinking about the FormatTime function but that is there in 4.2 also

So ..

Substr(FormatTime (CurrTime() ,"-"),0,5) would replace the previous one, FormatTime thus replacing TimeToText and Replace.

Would be nicer if the was something like the Format function with user spec possibillity like the VB function ..

Then Format(CurrTime(),"hh-mm") would be sufficient :-)

Regards,
Wim