Subject | Re: [firebird-support] How do I convert CURRENT_TIME and CURRENT_DATE to a string? |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2008-11-15T16:17:41Z |
dDate = extract(year from current_date);
if (extract(month from current_date) < 10) then
dDate = dDate || '0';
dDate = dDate || extract(month from current_date);
if (extract(day from current_date) < 10) then
dDate = dDate || '0';
dDate = dDate || extract(day from current_date);
I haven't checked whether current_date/current_time stay the same
throughout the execution of the stored procedure, if not assign it to a
date/time variable first.
HTH,
Set
SoftTech wrote:
if (extract(month from current_date) < 10) then
dDate = dDate || '0';
dDate = dDate || extract(month from current_date);
if (extract(day from current_date) < 10) then
dDate = dDate || '0';
dDate = dDate || extract(day from current_date);
I haven't checked whether current_date/current_time stay the same
throughout the execution of the stored procedure, if not assign it to a
date/time variable first.
HTH,
Set
SoftTech wrote:
> Firebird 1.5
>
> Inside of a stored procedure I declared the following:
> DECLARE VARIABLE tTime Time;
> DECLARE VARIABLE dDate Date;
>
> I then assigned them as follows:
> tTime = CURRENT_TIME;
> dDate = CURRENT_DATE;
>
> Which returns these value:
> 8:42:48 AM
> 11/15/2008
>
> I need to convert the time value to a string in the following format:
> 084248
>
> and I need to convert the date value to a string in the following format:
> 20081115
>
> Anyone with any idea how to accomplish this?
>
> Thanks for all who reply.
>
> Mike