A Agnes Dec 2, 2004 #1 If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot
If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot
S Scott Swigart Dec 2, 2004 #2 Dim d As DateTime = "2004-02-05" MessageBox.Show(d.Year.ToString("0000") & d.Month.ToString("00"))
H Herfried K. Wagner [MVP] Dec 2, 2004 #3 Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... \\\ MsgBox( _ Date.ParseExact( _ "2004-02-05", _ "yyyy-MM-dd", _ Nothing _ ).ToString("yyyyMM") _ ) ///
Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... \\\ MsgBox( _ Date.ParseExact( _ "2004-02-05", _ "yyyy-MM-dd", _ Nothing _ ).ToString("yyyyMM") _ ) ///
C Cor Ligthert Dec 2, 2004 #4 Agnes MyResultString = MyOriginalString.substring(0,4) & MyOriginalString.substring(5,2) I hope this helps? Cor "Agnes"
Agnes MyResultString = MyOriginalString.substring(0,4) & MyOriginalString.substring(5,2) I hope this helps? Cor "Agnes"
O Oenone Dec 2, 2004 #5 Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... To add another possible solution: Dim d As DateTime = DateTime.Parse("2004-02-05") MessageBox.Show(Format(d, "yyyyMM"))
Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... To add another possible solution: Dim d As DateTime = DateTime.Parse("2004-02-05") MessageBox.Show(Format(d, "yyyyMM"))
P Phill. W Dec 3, 2004 #6 Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... Dim dtThen as DateTime _ = CDate( "2004-02-05" ) Console.Writeline( dtThen.ToString("yyyyMM") ) ' NB: That's "MM", not "mm" HTH, Phill W.
Agnes said: If my input date is 2004-02-05, I want to get '200402' Can anyone know the simple way to do ? Thanks a lot Click to expand... Dim dtThen as DateTime _ = CDate( "2004-02-05" ) Console.Writeline( dtThen.ToString("yyyyMM") ) ' NB: That's "MM", not "mm" HTH, Phill W.