Hi Team,
i have a date in str format “XYZ11242023” → i want output as following “XYZ112423”
how will i achieve this COnvert.Todate did not worked for me
Hi Team,
i have a date in str format “XYZ11242023” → i want output as following “XYZ112423”
how will i achieve this COnvert.Todate did not worked for me
HI @Devasaiprasad_Kakumanu ,
let try
DateTime.ParseExact(str, “dddMMddyyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dddMMddyy”)
my eg:
regards,
Hi,
How about the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString,"\d{2}(?=\d{2}$)","")
Regards,
DateTime.ParseExact(inputstr,"XYZddMMyyyy",system.Globalization.CultureInfo.InvariantCulture).ToString("XYZ"+"ddMMyy")
Hi,
str_text = “XYZ11242023”
date_ = DateTime.ParseExact(str_text.Substring(3,str_text.Length-3), “MMddyyyy”, System.Globalization.CultureInfo.InvariantCulture)
result = str_text.Substring(0,3) + date_.ToString(“MMddyy”)
Hi, you can try below expression:
This will take the first 7 characters (“XYZ1124”) from the original string and concatenate them with the characters starting from the 9th position onwards (“23”), resulting in “XYZ112423”.
Try this:
Give below syntax in assign activity:
dateString = InputString.Substring(InputString.Length - 8)
parsedDate = DateTime.ParseExact(dateString, "MMddyyyy", System.Globalization.CultureInfo.InvariantCulture)
formattedDate = parsedDate.ToString("MMddyy")
OutputString = InputString.Substring(0, InputString.Length - 8) + formattedDate
parsedDate is of DataType System.DateTime, Other 3 is of DataType System.String
Hope it helps
How about this
’ Original date string
originalDateString As String = “XYZ11242023”
’ New date string with the year shortened
Dim newDateString As String = originalDateString.Substring(0, 5) & originalDateString.Substring(7)
your syntax indeed worked… but really i did not understood the syntax of Regex.
could you pls explain
Hi,
\d{2}
means 2 digits number.
$
means end of the string.
(?= )
means positive lookahead
from the above
(?=\d{2}$)
means “just before 2 digits number at the end of the string”
\d{2}(?=\d{2}$)
means “2 digits number just before 2 digits number at the end of the string”
As a result “20” of “XYZ11242023” will be replaced with empty string by the above regex expression.
Hope this helps you.
Regards,
thank you so much @Yoichi
To Modify the String into desired date format refer the below video,
Thanks in advnace,
Jayavignesh G