1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

誕生日を求める

Last updated at Posted at 2022-06-15

年だけならこれでもいい。

IF( NOT( ISBLANK( Birthdate ) ) ,
  IF( DATE( 2000 , MONTH( Birthdate ) , DAY( Birthdate ) ) <= DATE( 2000 , MONTH( TODAY() ) , DAY( TODAY() ) ),
     YEAR (Today()) - YEAR ( Birthdate ),
     YEAR (Today()) - YEAR ( Birthdate ) -1 ),
  null)

月と日もいるらしい。

IF(
  datetime_1 - datetime_2 > 0 ,
  TEXT( FLOOR( datetime_1 - datetime_2 ) ) & " days "
  & TEXT( FLOOR( MOD( (datetime_1 - datetime_2 ) * 24, 24 ) ) ) & " hours "
  & TEXT( ROUND( MOD( (datetime_1 - datetime_2 ) * 24 * 60, 60 ), 0 ) ) & " minutes",
  ""
)
IF( NOT( ISBLANK( Birthdate)), 
YEAR(DATEVALUE(CreatedDate))-YEAR(Birthdate )-
IF(ADDMONTHS(Birthdate ,12*(YEAR(DATEVALUE(CreatedDate))-YEAR(Birthdate )))<=DATEVALUE(CreatedDate), 0,1), NULL)
IF( NOT( ISBLANK( Birthdate)), 
YEAR(TODAY())-YEAR(Birthdate )-
IF(ADDMONTHS(Birthdate ,12*(YEAR(TODAY())-YEAR(Birthdate )))<=TODAY(), 0,1), NULL)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?