From 253cc6639c923838958a27095f05a696f39d90b4 Mon Sep 17 00:00:00 2001 From: RobHolme Date: Sat, 24 Jun 2017 16:42:58 +0800 Subject: [PATCH] Updated timestamp prefix of saved files to include a padded '0' for single digit date/time values. --- HL7Listener/HL7TCPListener.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HL7Listener/HL7TCPListener.cs b/HL7Listener/HL7TCPListener.cs index 171ec22..77fa80a 100644 --- a/HL7Listener/HL7TCPListener.cs +++ b/HL7Listener/HL7TCPListener.cs @@ -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);