当前位置:网站首页>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
边栏推荐
- What is information security? What is included? What is the difference with network security?
- [South China University of technology] information sharing of postgraduate entrance examination and re examination
- Rk3566 add LED
- matlab学习2022.7.4
- 物联网应用技术专业是属于什么类
- Selenium crawls Baidu pictures
- 链表(简单)
- How to introduce devsecops into enterprises?
- Simple process of penetration test
- 锚点导航小demo
猜你喜欢
Rk3566 add LED
如何深入理解“有限状态机”的设计思想?
几款分布式数据库的对比
uplad_ Labs first three levels
Simple process of penetration test
Scenario based technology architecture process based on tidb - Theory
Postman简介、安装、入门使用方法详细攻略!
Comparison of several distributed databases
Jetpack compose introduction to mastery
What are the advantages and characteristics of SAS interface
随机推荐
The forked VM terminated without saying properly goodbye
Elfk deployment
What are the advantages and characteristics of SAS interface
PHP5下WSDL,SOAP调用实现过程
Linked list (simple)
What is the future development trend of neural network Internet of things
[South China University of technology] information sharing of postgraduate entrance examination and re examination
关于Apache Mesos的一些想法
Guofu hydrogen energy rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, and 360million yuan of accounts receivable exceed the revenue
Liar report query collection network PHP source code
C - Divisors of the Divisors of An Integer Gym - 102040C
2022 driller (drilling) examination question bank and simulation examination
Source code analysis of etcd database -- peer RT of inter cluster network layer client
基于 TiDB 场景式技术架构过程 - 理论篇
Laravel generate entity
upload (1-6)
TiCDC 6.0原理之Sorter演进
R语言使用ggplot2包的geom_histogram函数可视化直方图(histogram plot)
matlab学习2022.7.4
SSH免密码登录详解