ben.kansas
20th May 2016, 17:48
Hello,
Quick question about the function utc.to.input() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_utc_to_input).
The documentation states that it returns a string, but that a zero indicates success and -1 an error.
So where is the formatted string stored? If the return value is essentially a long, then where is the formatted date string?
string datestr(10)
datestr = utc.to.input(tdcgs621.xdte, "%u(%m/%d/%Y)")
Where tdcgs621.xdte is a domain of tcdate (UTC).
Thanks,
Ben
bdittmar
20th May 2016, 19:40
Hello,
utc.to.input()
Syntax:
function string utc.to.input (long lvalue, const string format())
Description
This converts a UTC long format value to an input date string or an input time string (in local time). The format specified determines whether the function returns a date string or a time string.
Arguments
long lvalue A UTC long format value.
const string format()
Return values
0 Success.
-1 Error.
Your field is UTC Date !!!
Regards
Ajesh
20th May 2016, 21:38
Hello there
The function returns a string value. I think that is an error saying the function returns a long value. As much as i know, this function returns a string value and which is based on the format which we provide as the second parameter.
ben.kansas
20th May 2016, 21:46
Hi bdittmar,
Thanks for replying.
But you've not really answered my question.
Where is the converted UTC date stored as a string?
If the function returns a 0 for success and -1 for an error (to a string nonetheless) and there's not a string passed as a reference (like utc.to.inputstr$() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_utc_to_inputstr)) then where does it store the converted date?
Also, in regard to your point about tcdate, utc.to.date() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_utc_to_date) will quite happily take a domain of tcdate. A UTC Date/Time appears to be stored as a long.
Thanks,
Ben
bdittmar
21st May 2016, 20:58
Hello,
use sprintf$:
datestring = sprintf$("%D(%02m/%02d/%04Y)", tdcgs621.xdte)
Regards
ben.kansas
23rd May 2016, 22:28
Thanks, Bernd.
The sprintf$() function works great.
Appreciate the help.