Quote:
Originally Posted by Comedian2004
There are many ways to do it, but I like this way, as you now have the date broke down into months, day and year. You can then load it into a date var and then use date functions on it.
I have DD, MM and YY set up as strings, which is fine, since they contain leading zeros in them. You can use the val(MM) to turn them into integers. Caution when using VAL:
If will ignore spaces, so if you have 10 05 the val will be 1005 instead of the expected 10. This is by VB design, it only messed me up once when some whacko was naming his team with numbers. I use the - to separate the two, as 10-05, as a val of that would be 10. Then I can always search the string for the - to find the 05 value.
Hope this helps
|
I did something similar to this. .NET has a 'split' command that will split a string into an array if there are multiple instances of a character separating parts of the string. So I took the date (yyyy-mm-dd) and split it with the '-'. I checked the length of mm and dd, and if the length is less than 2, it adds a 0. After that, I just pulled them all together.
Thanks for the advice!