印刷
カテゴリ: FileMaker Custom Function
参照数: 379

 

年齢から生年月日の範囲を求める
基準日時点の生年月日の範囲
基準日が空欄の場合、現在の日付より算出

Find the range of date of birth from age
Range of birth dates as of the referenceDate
If the referenceDate is blank, calculate from the current date.

 

Sample input(入力例)
GetBirthdayRange ( 52 ; "2022/03/14" )


Sample output(出力例)
1969/03/15...1970/03/14


基準日が空欄の場合、現在の日付より算出
If the referenceDate is blank, calculate from the current date.

Sample input(入力例)
GetBirthdayRange ( 52 ; "" )


Sample output(出力例)
1969/03/15...1970/03/14


満年齢 の場合、+ 2 を追加
;~startDate = Date ( Month ( ~td ) ; Day ( ~td ) ; Year ( ~td ) -~age - 1 ) + 2
;~endDate = Date ( Month ( ~td ) ; Day ( ~td )-1 ; Year ( ~td ) -~age ) + 2


2022/03/14
出力結果が、1日連れていたのを修正
;~startDate = Date ( Month ( ~td ) ; Day ( ~td ) ; Year ( ~td ) -~age - 1 )
;~endDate = Date ( Month ( ~td ) ; Day ( ~td )-1 ; Year ( ~td ) -~age )

;~startDate = Date ( Month ( ~td ) ; Day ( ~td ) ; Year ( ~td ) -~age - 1 ) + 1
;~endDate = Date ( Month ( ~td ) ; Day ( ~td )-1 ; Year ( ~td ) -~age ) + 1

function(関数):
Sample input(入力例):
Sample output(出力例):
formula(式):

/*
GetBirthdayRange ( age ; referenceDate )

年齢から生年月日の範囲を求める
基準日時点の生年月日の範囲
基準日が空欄の場合、現在の日付より算出

Find the range of date of birth from age
Range of birth dates as of the referenceDate
If the referenceDate is blank, calculate from the current date.

GetBirthdayRange ( 50 ; "2021/12/06" )


GetBirthdayRange ( 50 ; "" )
*/

Let([
~age= GetAsNumber ( age )
;~td= If ( IsEmpty ( referenceDate ) ; Get ( 日付 ) ; GetAsDate ( referenceDate ) )
;~startDate = Date ( Month ( ~td ) ; Day ( ~td ) ; Year ( ~td ) -~age - 1 ) + 1
;~endDate = Date ( Month ( ~td ) ; Day ( ~td )-1 ; Year ( ~td ) -~age ) + 1
];
~startDate & "..." & ~endDate
)