Subject | Casting a Date to a Varchar inverts its format? |
---|---|
Author | dr_bentonquest |
Post date | 2006-12-08T01:29:22Z |
Firebird 1.5.3. here.
select invoicedate from invoices
invoicedate
-----------
01-01-2006
select cast(invoicedate as varchar(10)) from invoices
invoicedate
-----------
2006-01-01
Date format gets inverted and I don't want this. I need to concatenate
the date field to a varchar "time" field, like this:
invoicedatetime = cast(invoicedate as varchar(10)) || invoicetime;
But the result is:
"2006-01-01 09:21"
Same result if I do this (implicit conversion):
invoicedatetime = invoicedate || invoicetime;
What I need is this:
"01-01-2006 09:21"
What am I missing here and how can I accomplish what I need?
Thanks,
-Benton
select invoicedate from invoices
invoicedate
-----------
01-01-2006
select cast(invoicedate as varchar(10)) from invoices
invoicedate
-----------
2006-01-01
Date format gets inverted and I don't want this. I need to concatenate
the date field to a varchar "time" field, like this:
invoicedatetime = cast(invoicedate as varchar(10)) || invoicetime;
But the result is:
"2006-01-01 09:21"
Same result if I do this (implicit conversion):
invoicedatetime = invoicedate || invoicetime;
What I need is this:
"01-01-2006 09:21"
What am I missing here and how can I accomplish what I need?
Thanks,
-Benton