Skip to content

Conversation

@DestBro
Copy link
Contributor

@DestBro DestBro commented Jan 12, 2025

This commit adds new documentation detailing how to parse date-time columns from CSV files using a specific format pattern. It explains two approaches: providing the pattern as a raw string (e.g., "dd/MMM/yy h:mm a") and supplying a DateTimeFormatter instance (e.g., DateTimeFormatter.ofPattern("dd/MMM/yy h:mm a")). These options ensure that columns are correctly recognized and parsed as date-time rather than strings.

This commit adds new documentation detailing how to parse date-time columns from CSV files using a specific format pattern. It explains two approaches: providing the pattern as a raw string (e.g., "dd/MMM/yy h:mm a") and supplying a DateTimeFormatter instance (e.g., DateTimeFormatter.ofPattern("dd/MMM/yy h:mm a")). These options ensure that columns are correctly recognized and parsed as date-time rather than strings.
@Jolanrensen
Copy link
Collaborator

Hi! Thanks for the suggestion :)

I do, however, feel the documentation now suggests that supplying a date pattern is only possible for reading CSV, while it actually belongs to the parse operation.

Any operation that can parse String columns, like readCsv, readTsv, StringCol.convertTo<>() (and probably more in the future), can have a ParserOptions argument to configure things like Locale, null-strings, date-time patterns etc. So while it's a good explanation, I think generalizing it a tiny bit and linking to the parse operation would improve it even more :).

@Jolanrensen Jolanrensen added the documentation Improvements or additions to documentation (not KDocs) label Jan 13, 2025
@Jolanrensen
Copy link
Collaborator

@DestBro Great job! I'll do some small formatting and merge it into our docs :) thanks!

@Jolanrensen Jolanrensen merged commit a4b69ec into Kotlin:master Jan 14, 2025
@DestBro
Copy link
Contributor Author

DestBro commented Jan 14, 2025

@DestBro Great job! I'll do some small formatting and merge it into our docs :) thanks!

Thank you, this is my first contribution to an open source project :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation (not KDocs)

2 participants