ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Dynamically replace string with Current Date with specific format using C# and VB.Net<p>Hey <a class="username" rel="Nikhkhot">Nikhkhot</a>,</p> <p>Please refer below code.</p> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { string s = &#34;@date[DD-MM-YYYY] : FTP Reports&#34;; string format = s.Split(&#39;[&#39;)[1].Split(&#39;]&#39;)[0].ToLower().Replace(&#34;mmm&#34;, &#34;MMM&#34;).Replace(&#34;mm&#34;, &#34;MM&#34;); string Subject = s.Replace(&#34;@date[&#34; + s.Split(&#39;[&#39;)[1].Split(&#39;]&#39;)[0] + &#34;]&#34;, DateTime.Now.ToString(format)); Response.Write(Subject); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim s As String = "@date[DD-MM-YYYY] : FTP Reports" Dim format As String = s.Split("["c)(1).Split("]"c)(0).ToLower().Replace("mmm", "MMM").Replace("mm", "MM") Dim Subject As String = s.Replace("@date[" &amp; s.Split("["c)(1).Split("]"c)(0) &amp; "]", DateTime.Now.ToString(format)) Response.Write(Subject) End Sub</pre> <p><span style="text-decoration: underline;"><strong>Output</strong></span></p> <p>22-11-2018 : FTP Reports</p>https://www.aspforums.net:443/Threads/179772/Dynamically-replace-string-with-Current-Date-with-specific-format-using-C-and-VBNet/https://www.aspforums.net:443/Threads/179772/Dynamically-replace-string-with-Current-Date-with-specific-format-using-C-and-VBNet/Thu, 22 Nov 2018 04:27:03 GMT