Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Format date display
Sun, Feb 24 2008 4:34 AMPermanent Link

"Bobby Gallagher"
Hi

Is there any way to use the select statement to return a date in a format of
my choise

i.e SELECT FORMAT(jobdate, 'dd/mm/yy') from jobs

Regards

Bobby

Sun, Feb 24 2008 8:47 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Bobby

You don't say which version you're using but I can see two possible solutions

1. write a UDF
2. use EXTRACT and CAST

No. 1 is a doddle because you can just use the inbuilt Delphi formatting routines. No. 2 is just a slog to do it but is also fairly simple eg:

select _date,
CAST(Extract(DAY FROM _date) AS CHAR(2)) +'/'+
CAST(Extract(MONTH FROM _date) AS CHAR(2)) +'/'+
CAST(Extract(YEAR FROM _date) AS CHAR(4))
from tbl


Roy Lambert
Tue, Feb 26 2008 2:41 AMPermanent Link

"Bobby Gallagher"
Hi Roy

I am still using V3.30 and hoped that there was a function to display the
date - I already use the option 2 suggestion but thought that it was a bit
"clunky"

Thanks for the help

Regards

Bobby


"Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:8E06D30D-AB2A-4C6E-BDBD-6582E238E3CA@news.elevatesoft.com...
> Bobby
>
> You don't say which version you're using but I can see two possible
> solutions
>
> 1. write a UDF
> 2. use EXTRACT and CAST
>
> No. 1 is a doddle because you can just use the inbuilt Delphi formatting
> routines. No. 2 is just a slog to do it but is also fairly simple eg:
>
> select _date,
> CAST(Extract(DAY FROM _date) AS CHAR(2)) +'/'+
> CAST(Extract(MONTH FROM _date) AS CHAR(2)) +'/'+
> CAST(Extract(YEAR FROM _date) AS CHAR(4))
> from tbl
>
>
> Roy Lambert
>

Image