Question How to convert date

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,


I have a date like this 2/25/2011 but I would like it 25/2/2011. How can I do it?


Thanks in advance.


Best Regards
 
You could use the .ToString method with a format string.
datevariable.ToString("dd/MM/yy")

An alternative is to use the format function.
Format(datevariable, "dd/MM/yy")
 
Are you certain that this is a good idea?

Dates are dates - if they are stored as dates (!! not strings) they will be happy.

Users are users - they like to see and type dates the way they are used to doing it - you should not impose your personal preferred date format on your users, let them see and type dates in their Windows Regional Settings format and they will be happy.

Chris
 
Back
Top