Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 4 of 4 total |
days in a month |
Tue, Jul 8 2014 7:52 PM | Permanent Link |
ClockOn | does anyone know how to calculate how many days in a month?
including leap years dont think i could see a function for it. |
Wed, Jul 9 2014 7:43 PM | Permanent Link |
ClockOn | Figured out one way, just to set a date range and deduct one from the other, passing in the month required, in the example its just hard coded, seems to work.
Feb 2014 = 28 days: select cast('2014-' + '3' + '-01' as Date) - cast('2014-' + '2' + '-01' as Date) from Table1 |
Thu, Jul 10 2014 3:58 AM | Permanent Link |
Matthew Jones | ClockOn wrote:
> Figured out one way, just to set a date range and deduct one from the > other, passing in the month required, in the example its just hard > coded, seems to work. > > Feb 2014 = 28 days: > > select cast('2014-' + '3' + '-01' as Date) - cast('2014-' + '2' + > '-01' as Date) from Table1 Clever! I was pondering this (not having done it before) and thinking of doing the "one less than 2014-03-01" but thinking it would be complex for januaries etc. and getting the day part out. Yours is much better. -- Matthew Jones |
Thu, Jul 10 2014 7:21 PM | Permanent Link |
ClockOn | That is another way Matthew, thanks for the idea works just as easy, i like it:
extract(day from cast('2014-03-01' as Date) - 1) from Table1 |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |