Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ninmonkey/864017afd3de46c3156a9c39683b5263 to your computer and use it in GitHub Desktop.

Select an option

Save ninmonkey/864017afd3de46c3156a9c39683b5263 to your computer and use it in GitHub Desktop.
How to Importing names like `SEPTIEMBER` as spanish month names, to dates while using english locales

How can you convert a text column with SEPTIEMBER as a spanish month name to a date or even english name?

  1. specifically choose spanish es as your culture/locale in your "transform column types" step
  2. If that's not automatic, pick the format string for month names

Here's Power Query to prove it

[ 
    Date = #date(2024, 9, 1),
    SpanishName =  Date.ToText( Date, [ Format = "MMMM", Culture = "es"] ),
    AndBack = DateTime.FromText( SpanishName, [ Format="MMMM", Culture="es"]),
    IsRoundTrip = DateTime.Date( AndBack ) = Date,
    EnglishName =  Date.ToText( DateTime.Date(AndBack), [ Format = "MMMM", Culture = "en"] )
]

Output

Name Value
Date 2024-09-01
SpanishName septiembre
AndBack 2024-09-01 12:00:00 AM
IsRoundTrip True
EnglishName September

Format strings

You want MMMM for the full month name

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