Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to convert DD/MM/YYYY string dates to MM/DD/YYYY dates?

    Hi,

    How to convert DD/MM/YYYY string dates to MM/DD/YYYY dates? I would be simply happy that Stata recognize my string European dates to a Stata compatible format.

    I have tried playing with date():
    gen new_date=date(Date,"DMY")
    but it does not do the trick. Note that I am working with Stata 13. Thanks!

  • #2
    This is in effect a "does not work" report.

    The following shows how to get a string date arrriving as DMY displayed as MDY.


    Code:
    . di %tdn/d/CY daily("2/4/2022", "DMY")
      4/2/2022
    the two steps being a call to daily() (date() being the older function name) and assignment of date display format. For a variable you would need generate and format statements.

    If this doesn't answer the question we need

    (c) the code you used

    (d) a data example

    (e) the error message you received if any.

    FAQ Advice #12 applies as always.

    Comment

    Working...
    X