Skip to content

Commit

Permalink
strptime updated
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoGallego94 authored Dec 30, 2024
1 parent 7e0e141 commit 60df20b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions content/python/concepts/dates/terms/strptime/strptime.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ datetime.strptime(date_string, format)

It returns a `datetime` object, which represents the parsed date and time from the provided `date_string` according to the specified `format`.

## Example

```python
from datetime import datetime

# Define the date-time string and format
datetime_string = "27/12/2024 15:30:00"
datetime_format = "%d/%m/%Y %H:%M:%S"

# Parse the string into a datetime object
dt_object = datetime.strptime(datetime_string, datetime_format)

print(dt_object) #Output: 2024-12-27 15:30:00
```

## Codebyte Example

```codebyte/python
Expand Down

0 comments on commit 60df20b

Please sign in to comment.