Subject date functions
Author Russell Eva
Helen, This is an excerpt from our previous discussion. We subsequently did
as advised below and it appeared to be 100% _UNTIL_ the procedure fires at
00:00 hours and then some records were omitted. On inspection we found the
following

The following query does not return data as expected

select cast('TODAY' as TimeStamp) today, /* fine */
cast(cast(date_out as date) as TimeStamp) date_out, /* Fine */
cast(cast(date_out as timeStamp)as date) /* expected to display only
date, but still has the hours and minutes with */

from visit_accom_days



Do you have any clues please?

_____

From: Helen Borrie [mailto:helebor@...]
Sent: Friday, December 05, 2003 14:17
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] date functions



At 01:20 PM 5/12/2003 +0200, you wrote:
>OK what we have to do is automatically raise (billing) transactions for all
>days between last billed transaction and the day that the process fires.
>What we have is: Today (excluding time portion or defaulting to 00:00:00),
>The date in for the billing, and the date out for the billing. We must
>establish if the date out is earlier than start of day tomorrow (end of day
>today) then a new transaction must be created with a date in of start of
day
>FOR THAT DAY's tomorrow and date out for start of day the following day.
In
>Delphi trunc - ing the dates works just fine but this must take place in a
>SP
>
>If I could get just the date portion of the datetime then I could (as you
>know) just add integer values to increment the days. If there is another
>way to achieve this, I'm all ears :-)

Indeed there is. If you do
cast (any_timestamp as date) you get a date-only value. Then do
cast(that_date as timestamp) and you get the date + 00:00:00.0000.

You can also do
cast(any_timestamp as time) to get and hold the time-of-day from the
datestamp, if you need to perform some calculation when the day rolls over.

heLen








Yahoo! Groups Sponsor



ADVERTISEMENT

<http://rd.yahoo.com/SIG=12cb5uskc/M=258297.4271147.5470572.4049140/D=egroup
web/S=1705115386:HM/EXP=1070713053/A=1683962/R=0/*http:/www.techsmith.com/rd
r/ban/syah/default.asp> click here



<http://us.adserver.yahoo.com/l?M=258297.4271147.5470572.4049140/D=egroupmai
l/S=:HM/A=1683962/rand=417434215>


To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.



[Non-text portions of this message have been removed]