benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5459681f-e8ad-529d-ba8a-986c7c387fcc

Problem

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

complete prompt

from datetime import datetime
import os
from pathlib import Path

# Constants
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'

def task_func(file_path):
    """
    Determine the creation time of a file and convert it to a formatted string '% Y-% m-% d% H:% M:% S'.
    
    Parameters:
    file_path (str): The path to the file.
    
    Returns:
    str: The creation time of the file in the format '%Y-%m-%d %H:%M:%S'.
    
    Requirements:
    - datetime.datetime
    - os
    - pathlib.Path
    
    Example:
    
    Example:
    >>> task_func('/path/to/file.txt')
    '2023-09-28 12:30:45'
    """

instruct prompt

Determine the creation time of a file and convert it to a formatted string '% Y-% m-% d% H:% M:% S'.
The function should output with:
    str: The creation time of the file in the format '%Y-%m-%d %H:%M:%S'.
You should write self-contained code starting with:

Code

from datetime import datetime
import os
from pathlib import Path
# Constants
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
def task_func(file_path):

code prompt

Code

from datetime import datetime
import os
from pathlib import Path
# Constants
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
def task_func(file_path):

entry point

task_func

libs

  • datetime
  • pathlib
  • os

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