Formatting a timestamp field on the select statement in DB2?
Posted on 2004-08-30
How do I format a timestamp field during a select statement?
For instance, I am selecting this:
select my_timestamp, substr(my_text, 1, 80), substr(my_code, 1, 1) from my_table where my_timestamp > '2004-08-09-12.00.00'
but the output starts like this:
2004-08-09-12.00.00.25342 my text starts here and goes for a bunch o chars . . . A
What I would like is this:
2004-08-09-12:00.00 my text starts here and goes for a bunch o chars . . . A
Or better yet, I'd like to strip out the date (not the time) and automagically feed in the current date in the where clause... Right now, I just type in the date in my sql statement...