Created
September 25, 2018 03:45
-
-
Save rjdudley/88cd47cd10255f2dece0749436092349 to your computer and use it in GitHub Desktop.
U-SQL inline function to generate the timestamp from two fields.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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