Skip to content

doc: fix docstring for Dates.format#56682

Merged
IanButterworth merged 1 commit intoJuliaLang:masterfrom
inkydragon:cyhan/doc-Dates.format
Nov 28, 2024
Merged

doc: fix docstring for Dates.format#56682
IanButterworth merged 1 commit intoJuliaLang:masterfrom
inkydragon:cyhan/doc-Dates.format

Conversation

@inkydragon
Copy link
Copy Markdown
Member

Close #35286

Current docstring:

julia> using Dates

help?> Dates.format

...

  as a literal you can use the escape character backslash. The string
  "1996y01m" can be produced with the format "yyyy\ymm\m".

julia>
julia> using Dates

julia> "yyyy\ymm\m"
ERROR: ParseError:
# Error @ REPL[36]:1:6
"yyyy\ymm\m"
#    └┘ ── invalid escape sequence
Stacktrace:
 [1] top-level scope
   @ REPL:1

julia> Dates.format(Dates.now(), raw"yyyy\ymm\m")
"2024y11m"

julia> Dates.format(Dates.now(), "yyyy\\ymm\\m")  # Another way
"2024y11m"

@inkydragon inkydragon added the docs This change adds or pertains to documentation label Nov 26, 2024
@IanButterworth IanButterworth merged commit 60f0057 into JuliaLang:master Nov 28, 2024
@inkydragon inkydragon deleted the cyhan/doc-Dates.format branch November 28, 2024 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docstring] need to use raw string to backslash characters

2 participants