Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Article Evgeny Shvarov · Aug 16, 2016 1m read

Yet another use case for $translate: date conversion

Have you tried $Translate for date conversion?

USER>write $Translate("Dd.Mm.WwYy","WwYy-Mm-Dd","2015-08-02")

02.08.2015

Stolen from Russian forum and Alexander Koblov.

Comments

Jonathan Schulman · Sep 27, 2016

Excellent. It reminded me of the Translate example from my REXX programmer days, which I slightly reworked for Caché:

This example shows how to use the $TRANSLATE function to reorder the characters in a string. In the example, the last character of any four-character string specified as the third argument would be moved to the beginning of the string:

USER>write $Translate("4123","1234","abcd")

dabc
0