从出生日期开始寻找年龄 [英] Finding Age from Date of Birth

查看:81
本文介绍了从出生日期开始寻找年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储日期的数据库dd / mm / yyyy(英文约会

系统)和= date()在我的服务器中以相同的格式返回日期。


如何使用这两个日期找到年龄的人。


谢谢

gavin

I have a database with date of births stored dd/mm/yyyy (english dating
system) and =date() returns a date in the same format in my server.

how do i find the persons age using these two pieces of date.

thanks
gavin

推荐答案

你应该在数据库中执行计算(数据库也知道

当前日期)。


以下是VBScript和数据库方法:
http://www.aspfaq .com / 2233


-

Aaron Bertrand

SQL Server MVP
http://www.aspfaq.com/



" Gav" < GA ***** @ ntlworld.com>在消息中写道

news:DB *************** @ newsfep1-gui.server.ntli.net ...
You should perform the calculation in the database (the database knows the
current date also).

Here are both VBScript and database methods:
http://www.aspfaq.com/2233

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Gav" <ga*****@ntlworld.com> wrote in message
news:DB***************@newsfep1-gui.server.ntli.net...
我有一个数据库,出生日期存储dd / mm / yyyy(英文约会系统)和= date()在我的服务器中以相同的格式返回日期。

我怎么做使用这两个日期找到年龄的人。

感谢
gavin
I have a database with date of births stored dd/mm/yyyy (english dating
system) and =date() returns a date in the same format in my server.

how do i find the persons age using these two pieces of date.

thanks
gavin



age = dateiff(y,生日,现在)


全年给出它(y)

Gav < GA ***** @ ntlworld.com>在消息中写道

news:DB *************** @ newsfep1-gui.server.ntli.net ...
age = datediff("y",birthdate,now)

gives it in whole years ("y")
"Gav" <ga*****@ntlworld.com> wrote in message
news:DB***************@newsfep1-gui.server.ntli.net...
我有一个数据库,出生日期存储dd / mm / yyyy(英文约会系统)和= date()在我的服务器中以相同的格式返回日期。

我怎么做使用这两个日期找到年龄的人。

感谢
gavin
I have a database with date of births stored dd/mm/yyyy (english dating
system) and =date() returns a date in the same format in my server.

how do i find the persons age using these two pieces of date.

thanks
gavin



UncleWobbly写道:
UncleWobbly wrote:
age = datediff(" y",birthdate,now)

全年给出它(y)
age = datediff("y",birthdate,now)

gives it in whole years ("y")



不,它不是。请参阅Aaron的常见问题解答文章。


Bob Barrows

-

Microsoft MVP - ASP / ASP。 NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件


No, it doesn''t. See Aaron''s faq article for the reason.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


这篇关于从出生日期开始寻找年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆