Re: insert datetime based on a date field + fix time (12:00 noon)
Posted in 2003
John David Adamski wrote:
> I not sure how to do this. I'm creating a table that tells when a
> timesheets are due and this is a datetime field (timesheet_due).
>
> The timesheets are due at noon 5 days prior to the check date. The
> check date is from another table that I am using to create the
> timesheet table record.
>
> I can't get the syntax right to do this.
>
> insert into ts_table (keyfield, timesheet_due)
> select keyfield, ck_date - 5 units days ???something???
> from pay_table
> where .....>
> What do I replace ???somthing??? to get 12:00 for the time?
+ 12 UNITS HOUR?
You might want to think in terms of a more accurate statement, but it
is more verbose and what you've got would probably produce the same
answer:
EXTEND(ck_date, YEAR TO MINUTE) - 5 UNITS DAY + 12 UNITS HOUR
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/