I want to change date format for date string
Ex. /changeformat{'06/23/2016'} and result = 23 June 2016
I want to change date format for date string
Ex. /changeformat{'06/23/2016'} and result = 23 June 2016
\documentclass{article}
\def\changeformat#1{\xchangeformat#1\relax}
\def\xchangeformat#1/#2/#3\relax{%
#2 %
\ifcase#1 \or
January\or February\or March\or April\or May\or June\or July\or
August\or September\or October\or November\or December\fi
\ #3}
\begin{document}
\changeformat{06/23/2016} and result = 23 June 2016
\end{document}
This solution uses datetime2, so you can apply the official format for a given country, or any format you choose, with day of week.
Also, it works with any seperator of your choice, so if you can use 06/23/2016 ,06.23.2016 or whatever you throw at it.
The format-changing is done with xstring.
Output
Code
\documentclass[11pt, australian]{article}
\usepackage{babel}
\usepackage{xstring}
\usepackage[useregional, calc]{datetime2}
\newcommand{\changeformat}[1]{%
\StrRight{#1}{4}[\myyear]%
\StrLeft{#1}{2}[\mymonth]%
\StrMid{#1}{4}{5}[\mydate]%
\DTMdate{\myyear-\mymonth-\mydate}%
}
\DTMusemodule{british}{en-GB} % Only neaded for extra languages.
\begin{document}
\changeformat{06/23/2016}
\DTMsetdatestyle{iso}
\changeformat{06/23/2016}
\DTMsetdatestyle{ddmmyyyy}
\changeformat{06.23.2016}
\DTMlangsetup[en-GB]{abbr}
\DTMsetstyle{en-GB}
\DTMsetup{showdow}
\changeformat{06/23/2016}
\end{document}
\documentclass{scrartcl}
\renewcommand*\today{\number\day\space
\ifcase\month\or January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi\space
\number\year}
\begin{document}
\today
\end{document}