Laravel: set Locale to Dutch for translated dates

Use $user->created_at->translatedFormat('Y - F') instead of `$user->created_at->format('Y - F')`

// php file
// note: don't use format() but translatedFormat() instead
echo $user->created_at->translatedFormat('Y - F'); // 2025 - februari

When needed, you might want to add the locale to your docker image as well

// file: Dockerfile
RUN apt update && apt-get install -y locales && \
    sed -i '/nl_NL.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen

Click Here to Leave a Comment Below

Leave a Reply: