Skip to content

Instantly share code, notes, and snippets.

@skalahonza
Created October 27, 2020 14:00
Show Gist options
  • Save skalahonza/cd522cab0b2404039ea6e8e2fd72e94b to your computer and use it in GitHub Desktop.
Save skalahonza/cd522cab0b2404039ea6e8e2fd72e94b to your computer and use it in GitHub Desktop.
Logic Apps expression for converting SAP datetime format into YYYY-MM-DD
using System;
using System.Linq;
namespace PasswordAttack
{
static class Program
{
const string EXPRESSION = "replace(concat(take(items('For_each')?['DATAB'],4),'-',take(skip(items('For_each')?['DATAB'],4),2),'-',take(skip(items('For_each')?['DATAB'],6),2)),'0000-00-00','1753-01-01')";
static void Main(string[] args) =>
args
.Select(x => EXPRESSION.Replace("DATAB", x))
.Select(x => "@{" + x + "}")
.ToList()
.ForEach(Console.WriteLine);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment