donsrini
10th June 2002, 20:41
When using sprintf$ function in Baan, do we have a format code to print just the time we get using time.num()?

For dates eg: sprintf$("%D(%02m/%02d/%04Y)", date.num())
likewise do we have something for time.num()?

mahasund
10th June 2002, 21:19
time.num() function stores internally a Long type value where it is the number of seconds starting from midnight.

You have to convert using the arithmetic calculation

hours = time.num() / 3600
minutes = (time.num - (time.num() - 3600))/60

and so on.

then, you can use this in a display format 99:99:99 for hh:mm:ss

Good Luck,

mahasund

lbencic
10th June 2002, 21:33
As far as I know, there is not an equivelant of the time formats like there is in dates.

The function : dte$() returns the current date / time in string format, already converted to hours, minutes, seconds, such as:


string.date = dte$()


The string.date field will then contain:
YYMMDDHHMMSS

Y=Year
M=Month
D=Day
H=Hour
M=Minutes
S=Seconds

Mahasund's works as well, and is used more commonly in the Baan code. It's a little harder to debug though, because you are working with the seconds since midnight number at the beginning.

Also, we have found that issueing a date.num() command followed by the time.num() command has the slightest tiny chance of giving you the wrong answer for date and time, since on the date.num() command you could come back with a given date, just a fraction of a second before midnight, and then issuing the time.num() command gives you the time for just past midnight, making the wrong date/time combination. The dte$ command gives date and time in one shot, so they are always coordinated.

Good luck.

trchandra
10th June 2002, 22:10
You can use the following format to print only time...

string time(10)

time = sprintf$("%U(%02h%x%02m%x%02s %a)", utc.num())

regards

donsrini
10th June 2002, 22:45
Thank you lbencic, I guess I will stick to dte$.

Thank You all.