본문으로 건너뛰기
🛠️ToolsShed

Quarters Calculator

모든 날짜의 회계 또는 달력 분기를 찾으며 시작/종료 날짜와 경과 일수를 표시합니다.

이 도구 소개

분기 계산기는 특정 날짜가 어느 회계 분기 또는 달력 분기에 해당하는지 파악하고, 해당 분기의 시작일, 종료일 및 경과 일수를 제공합니다. 이 도구는 사업가, 회계사, 분기 단위로 업무, 예산, 보고 주기를 정리해야 하는 사람들에게 특히 유용합니다.

날짜를 입력하거나 선택하면 도구가 즉시 분기 표시(Q1, Q2, Q3, Q4), 해당 분기의 정확한 시작 및 종료 날짜, 분기 시작부터 선택한 날짜까지의 경과 일수를 보여줍니다. 달력 분기(1월-3월, 4월-6월, 7월-9월, 10월-12월)와 사용자 정의 시작월이 있는 회계 분기 간에 전환할 수 있습니다.

이 도구는 재무 계획, 프로젝트 마일스톤 추적, 세금 준비, 분기 주기에 맞춘 성과 평가에 이상적입니다. 판매 거래가 어느 분기에 발생했는지 결정해야 하든지 분기별 마감일에 맞춰 인도물을 계획해야 하든지, 이 계산기는 추측을 제거하고 시간을 절약합니다.

자주 묻는 질문

코드 구현

from datetime import date, timedelta
import calendar

def calendar_quarter(d):
    """Return Q1-Q4 for a calendar year date"""
    return (d.month - 1) // 3 + 1

def fiscal_quarter(d, fiscal_start_month=1):
    """Return fiscal quarter given fiscal year start month"""
    offset = (d.month - fiscal_start_month) % 12
    return offset // 3 + 1

def quarter_dates(year, q, fiscal_start_month=1):
    """Return (start, end) dates for a given fiscal quarter"""
    start_month = ((fiscal_start_month - 1 + (q - 1) * 3) % 12) + 1
    start_year = year if start_month >= fiscal_start_month else year - 1
    start = date(start_year, start_month, 1)
    # End = last day of 3rd month
    end_month = (start_month - 1 + 3 - 1) % 12 + 1
    end_year = start_year if end_month >= start_month else start_year + 1
    end = date(end_year, end_month, calendar.monthrange(end_year, end_month)[1])
    return start, end

d = date.today()
q = calendar_quarter(d)
start, end = quarter_dates(d.year, q)
print(f"Q{q}: {start} to {end}")
print(f"Days elapsed: {(d - start).days + 1}")
print(f"Days remaining: {(end - d).days}")

# Fiscal year starting April (UK standard)
fq = fiscal_quarter(d, fiscal_start_month=4)
print(f"UK Fiscal Q{fq}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.