0
0

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.

【数式】military format (0 to 23) for the hours

Posted at

以下は夏時間を考慮している

IF( OR(
CREATED_DATE<= DATETIMEVALUE(DATE(YEAR(DATEVALUE(CREATED_DATE)),3,14)
-(WEEKDAY(DATE(YEAR(DATEVALUE(CREATED_DATE)),3,14))-1))+7/24, /*If the date/time is before the second Sunday in March (end of wintertime)*/
CREATED_DATE>= DATETIMEVALUE(DATE(YEAR(DATEVALUE(CREATED_DATE)),11,7)
-(WEEKDAY(DATE(YEAR(DATEVALUE(CREATED_DATE)),11,7))-1))+7/24 /*Or if the date/time is after the first Sunday in November (start of wintertime)*/
),

HOUR(TIMEVALUE(CREATED_DATE-5/24))
-IF(HOUR(TIMEVALUE(CREATED_DATE-5/24))>23,24,0) /*return the hour in military format and offset it by 5 hours for wintertime*/
,
HOUR(TIMEVALUE(CREATED_DATE-4/24))
-IF(HOUR(TIMEVALUE(CREATED_DATE-4/24))>23,24,0)) /*return the hour in military format and offset it by 4 hours for summertime*/
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?