benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 952eedc5-ed1b-5b36-9f4d-b4b200eee791

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import pytz
from dateutil.parser import parse


def task_func(date_str, from_tz, to_tz):
    """
    Convert a date string from one time zone to another and return the time difference in seconds to the current time
    in the destination time zone.

    Parameters:
    date_str (str): The date string in "yyyy-mm-dd hh:mm:ss" format.
    from_tz (str): The timezone of the given date string.
    to_tz (str): The timezone to which the date string should be converted.

    Returns:
    int: The time difference in seconds.

    Requirements:
    - pytz
    - dateutil.parser
    Example:
    >>> type(task_func('2022-10-22 11:59:59', 'UTC', 'America/Chicago'))
    <class 'int'>
    """

instruct prompt

Convert a date string from one time zone to another and return the time difference in seconds to the current time in the destination time zone.
The function should output with:
    int: The time difference in seconds.
You should write self-contained code starting with:

Code

import pytz
from dateutil.parser import parse
def task_func(date_str, from_tz, to_tz):

code prompt

Code

import pytz
from dateutil.parser import parse
def task_func(date_str, from_tz, to_tz):

entry point

task_func

libs

  • pytz
  • dateutil

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import