Yes, and it is nice to know that this is an option. I am using a VB wrapper though and not using the SQLite dll. Will figure something out.
RBS -----Original Message----- From: John Stanton [mailto:[EMAIL PROTECTED] Sent: 17 December 2006 23:05 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Calculate years and months difference with Julian Date? I answered your question. It is possible and showed you how to do it. The rest is up to you. RB Smissaert wrote: > I am not into C and I want to stay clear from compiling SQLite. > Or do I misunderstand this? > > RBS > > -----Original Message----- > From: John Stanton [mailto:[EMAIL PROTECTED] > Sent: 17 December 2006 20:38 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Calculate years and months difference with Julian > Date? > > Have a look at Sqlite date code. I just lifted its data structures and > used its functions to build user functions to give month etc. The > algorithms are accurate and they are easy to use. I found setting up > user functions to do those calculations made the SQL simpler. > > The functions are in a file called date.c. Here is one function which > we added to Sqlite to get the month number as an example - > > *!!!TSI addition.*/ > /*-- monthFunc --------------------------------------------- > Return the month number. Added by TSI.*/ > static void monthFunc(sqlite3_context *context, int argc, > sqlite3_value **argv){ > > DateTime x; > > if (isDate(argc, argv, &x) == 0){ > computeYMD(&x); > sqlite3_result_int(context, x.M); > } /*if*/ > } /*monthFunc*/ > /*!!!End TSI addition.*/ > > RB Smissaert wrote: > >>Is it possible with Julian dates in 2 fields to calculate the months > > and/or > >>years difference between those 2 dates? >> >>I know I can subtract the 2 dates and divide by 30 (or 30.42) or 365 and >>take it from there, but I would like it a bit more precise, so for > > example: > >>Is 2 March 2006 more than one month after 1 February 2006? >>If calculated with a simple division the answer would be no, but I would >>like it to be yes. >> >>Had a look at the date/time functions on the WIKI site, but couldn't see > > it. > >>RBS >> >> >> >> >> > > ---------------------------------------------------------------------------- > - > >>To unsubscribe, send email to [EMAIL PROTECTED] >> > > ---------------------------------------------------------------------------- > - > > > > ---------------------------------------------------------------------------- > - > To unsubscribe, send email to [EMAIL PROTECTED] > ---------------------------------------------------------------------------- > - > > > > > ---------------------------------------------------------------------------- - > To unsubscribe, send email to [EMAIL PROTECTED] > ---------------------------------------------------------------------------- - > ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------