当前位置:网站首页>MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
2022-07-05 14:10:00 【sr_ www】
FUNCTION `idcard2age`(`idcard` varchar(255)) RETURNS int(10)
BEGIN
if(length(idcard)=18)then
return ifnull(timestampdiff(YEAR,substring(idcard,7,8),now()),-1);
elseif(length(idcard)=15)then
return ifnull(timestampdiff(YEAR,concat('19',substring(idcard,7,6)),now()),-1);
end if;
RETURN -1;
END
边栏推荐
- LeetCode_3(无重复字符的最长子串)
- Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
- Laravel - view (new and output views)
- POI set the data format of the column (valid)
- Rk3566 add LED
- Anchor navigation demo
- Linked list (simple)
- 鸿蒙第四次培训
- Those things I didn't know until I took the postgraduate entrance examination
- What is information security? What is included? What is the difference with network security?
猜你喜欢
Network security - Novice introduction
TDengine 社区问题双周精选 | 第三期
Xampp configuring multiple items
UE source code reading [1]--- starting with problems delayed rendering in UE
SAS接口有什么优势特点
[machine learning notes] several methods of splitting data into training sets and test sets
Postman简介、安装、入门使用方法详细攻略!
upload (1-6)
牛客网:拦截导弹
How to introduce devsecops into enterprises?
随机推荐
laravel-dompdf导出pdf,中文乱码问题解决
Recommendation number | what are interesting people looking at?
:: ffff:192.168.31.101 what address is it?
LeetCode_69(x 的平方根 )
[buuctf.reverse] 152-154
Scenario based technology architecture process based on tidb - Theory
Xampp configuring multiple items
C - Divisors of the Divisors of An Integer Gym - 102040C
Google EventBus 使用详解
Laravel - view (new and output views)
Comparison of several distributed databases
2022建筑焊工(建筑特殊工种)特种作业证考试题库及在线模拟考试
3W原则[通俗易懂]
Ordering system based on wechat applet
关于Apache Mesos的一些想法
03_Solr之dataimport
Requests + BS4 crawl Douban top250 movie information
Why do I support bat to dismantle "AI research institute"
几款分布式数据库的对比
Liste des liens (simple)