469,579 Members | 1,290 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

Wierd Date Format Problem In TextBox

Hello There.

I am programming with visual basic within the Excel realm.

I have a problem with the way my selected textbox recognizes dates generated from the datepicker.

I am from New Zealand and have set me PC regional settings accordingly.
Our date format is 26 October 2006, 26/10/06.

I have formatted the textbox with the following code:

textbox60.Value = DTPicker1.Value
textbox60 = Format(textbox60, "dddd d mmmm")

This works fine if the days in the month are 13th and above.
Example: Date selected 26/10/06, the text will display as:

Thursday 26 October

But if the days are below the 13th, example:02/10/06, the date will display as:

Friday 10 February

I can see what is happening, the dates are swapping to the U.S format of 10/02/06, this is extremely annoying!!

Can anyone help with some clean up code?

Yours " Visual Virgin'
Oct 18 '06 #1
1 1491
Killer42
8,435 Expert 8TB
Hi, just thought I'd jump in since you haven't got any replies yet.

Could you tell me exactly what data type the DTPicker returns in its Value property? It might be that you are transferring it with some sort of default format, and we all know what that means. Perhaps you need to apply Format() when retrieving this value (and perhaps skip an intermediate step). In other words, instead of
Expand|Select|Wrap|Line Numbers
  1. textbox60.Value = DTPicker1.Value
  2. textbox60 = Format(textbox60, "dddd d mmmm")
maybe you need to say something along these lines
Expand|Select|Wrap|Line Numbers
  1. textbox60.Value = Format(DTPicker1.Value, "dddd d mmmm")
  2.  
Oct 24 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.