datetime type data
Posted in 1993
Topics: Error Codes & Troubleshooting
>>From: George Ma <gm0564@swuts.sbc.com>
>>Subject: datetime data
>>Has any one had experience to retrieve datetime type data into sqlda and then
>>to convert it into char string using dttoasc()?
>>I tried but dttoasc() failed to provide correct data.
>>I wonder whether datetime type data has to be FETCHed INTO a host variable of
>>type dtime_t but cannot be loaded into sqlda since there is no way to
>>initialize dt_qual field if sqlda is used?
>>Thanks in advanced for any information.
>>George,
I did not use the dttoasc() function but did use the data extracted
in this function. See if this might help.
getnbr()
{
$ long nxbr;
char spec;
int mynbr;
/*--------TIME STUFF-------------------*/
long seconds, time();
char usertime[10], *getlogin();
struct tm *timerec, *localtime();
seconds = time((long *) 0);
timerec = localtime(&seconds);
/*--------END TIME STUFF --------------*/
$ select nxt_nbr into $nxbr from nxtnbr where nxt_field_name = "NEXT2121";
spec='-';
if (sqlca.sqlcode == 0)
/* dectoint(&nxbr,&mynbr); */
/* sprintf(usertime, "%#.4d%c%02d", mynbr,spec,timerec->tm_year); */
/*--------TIME STUFF-------------------*/
sprintf(usertime, "%#.4d%c%02d", nxbr,spec,timerec->tm_year);
pf_putval(usertime, CCHARTYPE, "nbr2121");
/*--------END TIME STUFF --------------*/
pf_putval(&nxbr, CLONGTYPE, "zzz");
}
Cheryl Gross
Red River Army Depot
Texarkana, TX
(903) 334-3518
cheryl@redriverad-emh1.army.mil