Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 6 of 6 total |
Extract End of week from Date |
Tue, Oct 9 2007 7:35 PM | Permanent Link |
"Adam H." | Hi,
I was wondering if their is an SQL equivalent to the "EndOfTheWeek" function in the dateutils.pas unit? (I'm trying to calculate the date of next "Saturday" of any given date). Thanks & Regards Adam. |
Wed, Oct 10 2007 6:43 AM | Permanent Link |
Bruno Krayenbuhl | (I'm trying to calculate the date of next "Saturday" of any given date). var Saturday, ThisDay : TdateTime; ... Saturday := ThisDay - DayOfWeek(ThisDay) + 7; Note : in SQL Monday is Day 1 of week in Delphi Sunday is Day 1 of Week Bruno |
Wed, Oct 10 2007 6:07 PM | Permanent Link |
"Adam H." | Hi Bruno,
Thanks for your reply. My apologies - I probably should have made myself a little clearer. I was wondering if there was a DBISam SQL function that may do this, or should I write one of my own? Thanks & Regards Adam. > var > Saturday, > ThisDay : TdateTime; > > Saturday := ThisDay - DayOfWeek(ThisDay) + 7; > > Note : in SQL Monday is Day 1 of week > in Delphi Sunday is Day 1 of Week > > Bruno |
Wed, Oct 10 2007 6:29 PM | Permanent Link |
"Robert" | "Adam H." <ahairsub4@pleaseREMOVEme.jvxp.com> wrote in message news:75C1C19B-9452-4527-A051-9107FAF2B51D@news.elevatesoft.com... > Hi Bruno, > > Thanks for your reply. My apologies - I probably should have made myself a > little clearer. I was wondering if there was a DBISam SQL function that > may do this, or should I write one of my own? > Write Bruno's code in SQL Current_Date - extract(dayofweek from current_date) + 6 as Sat Robert > Thanks & Regards > > Adam. > > > var >> Saturday, >> ThisDay : TdateTime; >> >> Saturday := ThisDay - DayOfWeek(ThisDay) + 7; >> >> Note : in SQL Monday is Day 1 of week >> in Delphi Sunday is Day 1 of Week >> >> Bruno > |
Wed, Oct 10 2007 11:11 PM | Permanent Link |
"Adam H." | Hi Robert,
> Write Bruno's code in SQL > > Current_Date - extract(dayofweek from current_date) + 6 as Sat Aah - I see - thanks for that. Cheers Adam. |
Fri, Oct 12 2007 8:37 AM | Permanent Link |
Dan Rootham | Bruno,
<< in Delphi Sunday is Day 1 of Week >> It depends.... because there are two different functions: DayOfWeek and DayOfTheWeek. From the Delphi 7 Help file: "DayOfTheWeek is ISO 8601 compliant (where Monday is considered the first day of the week). To obtain the day of the week where Sunday is considered the first day of the week, use the DayOfWeek function instead." Regards, Dan |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |