RE: getting the number of years between two dates
sql,query How do I do that? The contaxt is that I want to get somebody's age based upon the current date. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: getting the number of years between two dates
John Meyer wrote: sql,query How do I do that? The contaxt is that I want to get somebody's age based upon the current date. There are several examples in the mailing list archives; but try subtracting the UNIX_TIMESTAMP of each date (which is the time in seconds) and then divide by the number of seconds in a year (~365*86400) ... -- Michael T. Babcock C.T.O., FibreSpeed Ltd. http://www.fibrespeed.net/~mbabcock - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: getting the number of years between two dates
Actually figured out one of my own: FLOOR(PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM NOW()),EXTRACT(YEAR_MONTH FROM UserDOB))/ 12) as Age It's amazing what you can think of as soon as you ask the question. -Original Message- From: Michael T. Babcock [mailto:mbabcock;fibrespeed.net] Sent: Thursday, November 07, 2002 1:58 PM To: John Meyer Cc: [EMAIL PROTECTED] Subject: Re: getting the number of years between two dates John Meyer wrote: sql,query How do I do that? The contaxt is that I want to get somebody's age based upon the current date. There are several examples in the mailing list archives; but try subtracting the UNIX_TIMESTAMP of each date (which is the time in seconds) and then divide by the number of seconds in a year (~365*86400) ... -- Michael T. Babcock C.T.O., FibreSpeed Ltd. http://www.fibrespeed.net/~mbabcock - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: getting the number of years between two dates
Well, actually I always use the Unix date format because is easier to use with PHP... and makes easier to do this kind of calculations... ;) -Mensaje original- De: John Meyer [mailto:johnmeyer_1978;yahoo.com] Enviado el: jueves, 07 de noviembre de 2002 15:20 Para: Michael T. Babcock CC: [EMAIL PROTECTED] Asunto: RE: getting the number of years between two dates Actually figured out one of my own: FLOOR(PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM NOW()),EXTRACT(YEAR_MONTH FROM UserDOB))/ 12) as Age It's amazing what you can think of as soon as you ask the question. -Original Message- From: Michael T. Babcock [mailto:mbabcock;fibrespeed.net] Sent: Thursday, November 07, 2002 1:58 PM To: John Meyer Cc: [EMAIL PROTECTED] Subject: Re: getting the number of years between two dates John Meyer wrote: sql,query How do I do that? The contaxt is that I want to get somebody's age based upon the current date. There are several examples in the mailing list archives; but try subtracting the UNIX_TIMESTAMP of each date (which is the time in seconds) and then divide by the number of seconds in a year (~365*86400) ... -- Michael T. Babcock C.T.O., FibreSpeed Ltd. http://www.fibrespeed.net/~mbabcock - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Getting the number of years between two dates
Hi, i found a method to do this: try extract(year from date1) - extract(year from date2) I hope it will work Michael -Ursprüngliche Nachricht- Von: Augusto Cesar Castoldi [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 26. Juni 2001 19:06 An: [EMAIL PROTECTED] Betreff: Getting the number of years between two dates It's possible get the number of years between two dates in a mysql function? thanks, Augusto - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Getting the number of years between two dates
At 3:05 PM -0300 6/26/01, Augusto Cesar Castoldi wrote: It's possible get the number of years between two dates in a mysql function? That kind of depends on what you mean by the number of years between two dates. For example, do you define the number of years between 2000-12-31 and 2001-01-01 as 0 or as 1 or as some fractional number? thanks, Augusto -- Paul DuBois, [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php