How can I format this date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
When I use msgbox(Now().ToShortDateString) I get 4/21/2005. How can I
convert that to 042105.

Thanks
 
Hi,
When I use msgbox(Now().ToShortDateString) I get 4/21/2005. How can I
convert that to 042105.

Thanks

Assuming that the result you want is a string "042105" and not an
integer then you need to parse the given string.

First locate the two slashes and split the input into three parts.
You may want to use String.Split() to do this.
Second look at the length of each separate part and either add a '0'
on the front or chop off the first two characters as required.
Third concatenate the three parts to give the result.

If you have difficulties with this then post your code here and we can
have a look at it.

rossum



The ultimate truth is that there is no ultimate truth
 
Back
Top