Subject | Re: Add Year function |
---|---|
Author | Adam |
Post date | 2006-04-13T06:46:47Z |
> The reason I need to add 100 years is I exported data from MSAccess 2
> to Firebird.became
> I found some of the date were not Y2K compliant, eg. 04/06/2001
> 04/06/1901.OK, well you can just add the appropriate number of days.
>
> So I need to convert them by adding 100 years into the data.
> If the date is less than 1910 after export I found these need to be
> added by 100 years, that's why I need the update statement.
For dates >= 1 Mar 1900, simply add 36525
For dates <= 28 Feb 1900, simply add 36524
For the date 29 Feb 1900, there is no corresponding day (you are
stuffed in this case). 1900 is a leap year but 2000 was not.
Adam
>are.
> --- In firebird-support@yahoogroups.com, "Adam" <s3057043@> wrote:
> >
> > --- In firebird-support@yahoogroups.com, "alanpltse" <alanpltse@>
> > wrote:
> > >
> > > Hi Adam,
> > >
> > > I created the UDF by the scripts with no error:
> > > DECLARE EXTERNAL FUNCTION ADDYEAR
> > > DATE,
> > > INTEGER
> > > RETURNS DATE BY VALUE
> > > ENTRY_POINT 'IB_UDF_AddYear' MODULE_NAME 'ib_udf'
> > >
> > > So I assume Firebird knows where 'IB_UDF_AddYear' and 'ib_udf'
> > >seems not
> > > But it only happens when I create the stored procedure, it
> > > related to the date format.100
> > >
> > > As the error message pointed to the entry_point and module_name.
> > >
> > > Besides using UDF, any way inside the stored procedure can add
> > > years to the date ?then
> > >
> > > Alan
> >
> > Perhaps using extract keyword you could reduce it to the elements
> > combine it somehow. Out of curiousity, how do you intend onhandling
> > leap years and days from previous centuries where people did notagree
> > on the date because they didn't want to switch calendars?add, it
> >
> > +1 adds a day, so providing you know how many days you want to
> > is pretty simple.
> >
> > Adam
> >
>