Yyyy-M-D To Yyyy-Mm-Dd Conversion In Vb Script
Hello,
I used a Manufacture Date picker and wanted to add a offset of 36 months to the Expiry Date via VB SCRIPT. I managed to add 36 months to the date picker but I'm struggling to get "YYYY-MM-DD" for the expiry date format. (I did this in TRANSFORMS -> VB SCRIPT -> OnProcessData)
I am getting an output in "YYYY-M-D" format for Months/Dates from 1-9 instead of "YYYY-MM-DD"
{ EXAMPLE ::: 2019-3-7 instead of 2019-03-07 }
Can someone please help me on this? I am including the code below and attaching the file for your reference.
[attachment=2072:OFFSET - ExpDate DRAFT.btw]
Thanks!
-
I just found a way to make this work!
Replacing the last line of my previous code with the following helped me to get the desired format.
Value = Year(Value) & "-" & Right("0" & Month(Value), 2) & "-" & Right("0" & Day(Value), 2)
Hope this helps. Any other suggestions are welcome.
Thanks.0 -
Hi Legacy Poster,
Thanks for code. It is works for my case.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare