コード例 #1
0
def weekday(ctx, date):
    """
    Returns the day of the week of a date (1 for Sunday to 7 for Saturday)
    """
    return ((conversions.to_date_or_datetime(date, ctx).weekday() + 1) % 7) + 1
コード例 #2
0
def year(ctx, date):
    """
    Returns only the year of a date
    """
    return conversions.to_date_or_datetime(date, ctx).year
コード例 #3
0
def edate(ctx, date, months):
    """
    Moves a date by the given number of months
    """
    return conversions.to_date_or_datetime(
        date, ctx) + relativedelta(months=conversions.to_integer(months, ctx))
コード例 #4
0
def month(ctx, date):
    """
    Returns only the month of a date (1 to 12)
    """
    return conversions.to_date_or_datetime(date, ctx).month
コード例 #5
0
ファイル: excel.py プロジェクト: rapidpro/expressions
def year(ctx, date):
    """
    Returns only the year of a date
    """
    return conversions.to_date_or_datetime(date, ctx).year
コード例 #6
0
def day(ctx, date):
    """
    Returns only the day of the month of a date (1 to 31)
    """
    return conversions.to_date_or_datetime(date, ctx).day
コード例 #7
0
ファイル: excel.py プロジェクト: rapidpro/expressions
def weekday(ctx, date):
    """
    Returns the day of the week of a date (1 for Sunday to 7 for Saturday)
    """
    return ((conversions.to_date_or_datetime(date, ctx).weekday() + 1) % 7) + 1
コード例 #8
0
ファイル: excel.py プロジェクト: rapidpro/expressions
def month(ctx, date):
    """
    Returns only the month of a date (1 to 12)
    """
    return conversions.to_date_or_datetime(date, ctx).month
コード例 #9
0
ファイル: excel.py プロジェクト: rapidpro/expressions
def edate(ctx, date, months):
    """
    Moves a date by the given number of months
    """
    return conversions.to_date_or_datetime(date, ctx) + relativedelta(months=conversions.to_integer(months, ctx))
コード例 #10
0
ファイル: excel.py プロジェクト: rapidpro/expressions
def day(ctx, date):
    """
    Returns only the day of the month of a date (1 to 31)
    """
    return conversions.to_date_or_datetime(date, ctx).day
コード例 #11
0
ファイル: excel.py プロジェクト: Vandeabdou/expressions
def weeknum(ctx, date):
    """
    Returns the num of the week of a date (Between 1 and 52)
    """
    return (conversions.to_date_or_datetime(date, ctx).isocalendar()[1])