Skip to content

Instantly share code, notes, and snippets.

@rjdudley
Created September 25, 2018 03:45
Show Gist options
  • Save rjdudley/88cd47cd10255f2dece0749436092349 to your computer and use it in GitHub Desktop.
Save rjdudley/88cd47cd10255f2dece0749436092349 to your computer and use it in GitHub Desktop.
U-SQL inline function to generate the timestamp from two fields.
public string GenerateTimestamp(string timestamp, string offset)
{
// timestamp comes from log file as [25/Dec/2017:00:14:58
// offset comes from log file as -0500]
// I need to trim the brackets and change the first : to a T
string stamp, part1, part2;
part1 = timestamp.Replace("[", "");
part2 = offset.Replace("]", "");
StringBuilder stampdate = new StringBuilder(part1);
stampdate[11] = 'T';
stamp = string.Concat(stampdate.ToString(), part2);
return stamp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment