Skip to content

Commit

Permalink
Updated timestamp prefix of saved files to include a padded '0' for s…
Browse files Browse the repository at this point in the history
…ingle digit date/time values.
  • Loading branch information
RobHolme committed Jun 24, 2017
1 parent 360a573 commit 253cc66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion HL7Listener/HL7TCPListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void ReceiveData(object client)
string messageTrigger = message.GetMessageTrigger();
string messageControlID = message.GetHL7Item("MSH-10")[0];
//string acceptAckType = message.GetHL7Item("MSH-15")[0];
string dateStamp = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString();
string dateStamp = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2,'0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0');
string filename = dateStamp + "_" + (filenameSequenceStart + messageCount).ToString("D6") + "_" + messageTrigger + ".hl7"; // increment sequence number for each filename
// Write the HL7 message to file.
WriteMessagetoFile(message.ToString(), this.archivePath + filename);
Expand Down

0 comments on commit 253cc66

Please sign in to comment.