什么是使用Flex计算时代的最好方法?方法、时代、Flex

2023-09-09 21:25:17 作者:心若冰凉人自亡

什么是计算时代使用Flex的最佳方法是什么?

解决方案

我发现了在这个页面的评论部分的底部(也就是现在的脱机)。

  

jpwrunyan说,2007年4月30号在10:10 PM:

          

顺便说一句,这里是如何计算年(只)从出生日期年龄,而无需考虑闰年:

  

通过将小幅盘整通过细威麟,在code读

 私有函数getYearsOld(出生日期:日期):UINT {
    VAR现在:日期=新的日期();
    VAR yearsOld:UINT =号(now.fullYear) - 数字(dob.fullYear);
    如果(dob.month> now.month ||(dob.month == now.month和放大器;&安培; dob.date> now.date))
    {
       yearsOld--;
    }
    返回yearsOld;
}
 

       聊聊Flexbox布局中的flex的演算法

该处理大多数情况下,你需要计算年龄。

  

What is the best way to calculate Age using Flex?

解决方案

I found an answer at the bottom of this page in comments section (which is now offline).

jpwrunyan said on Apr 30, 2007 at 10:10 PM :

By the way, here is how to calculate age in years (only) from DOB without needing to account for leap years:

With a slight correction by Fine-Wei Lin, the code reads

private function getYearsOld(dob:Date):uint {  
    var now:Date = new Date();  
    var yearsOld:uint = Number(now.fullYear) - Number(dob.fullYear);  
    if (dob.month > now.month || (dob.month == now.month && dob.date > now.date)) 
    {
       yearsOld--;
    }
    return yearsOld;  
}

This handles most situations where you need to calculate age.