### Replace YYYYMMDD

This sub replaces a date placeholder YYYYMMDD to the actual date.
Example YYYYMMDD
'Replace the string YYYYMMDD by actual Year Month and Day of Week
'Example:
'Dim s as string = "Actual Date in Format YYYYMMDD is %YYYYMMDD%"
's = s.Replace("%YYYYMMDD%", ReplaceYYYYMMDD)
`Sub ReplaceYYYYMMDD As String
Dim year As String = DateTime.GetYear(DateTime.Now)
Dim month As String = DateTime.GetMonth(DateTime.Now)
If month.Length = 1 Then month = "0" & month
Dim day As String = DateTime.GetDayOfMonth(DateTime.Now)
If day.Length = 1 Then day = "0" & day
Return year & month & day
End Sub`
Example YYYY-MM-DD
'Replace the string YYYY-MM-DD by actual Year Month and Day of Week
'Example:
'Dim s as string = "Actual Date in Format YYYY-MM-DD is %YYYY-MM-DD%"
's = s.Replace("%YYYY-MM-DD%", ReplaceYYYYMMDD2)
`Sub ReplaceYYYYMMDD2 As String
Dim year As String = DateTime.GetYear(DateTime.Now)
Dim month As String = DateTime.GetMonth(DateTime.Now)
If month.Length = 1 Then month = "0" & month
Dim day As String = DateTime.GetDayOfMonth(DateTime.Now)
If day.Length = 1 Then day = "0" & day
Return year & "-" & month & "-" & day
End Sub`

Changed: , Category: DateTime, File: T6C183M1334.htm, ID: 1334