Question Change DD-MM-YYYY to MM-DD-YYYY

digitaldrew

Well-known member
Joined
Nov 10, 2012
Messages
167
Programming Experience
Beginner
Maybe someone can help me out a little here...

There are a few features in my program which use dates to display dateandtime.today ..etc. With most computers it's no problem because they use the standard American format which is MM-DD-YYYY. However, I've found that people in Greece actually have a standard of DD-MM-YYYY.

My question is... Is there an easy way to have the program see if their computer uses the MM-DD-YYYY format and then just automatically convert it DD-MM-YYYY for use inside the program?

Thanks!
 
Why would you need to do such a thing? Unless you have a very good reason to do otherwise, you should let every user enter and view dates in the format they expect. .NET DateTime values are binary and therefore have no format so there's no issue there. If you need to parse a date from text then you simply accept the system default and the same goes for displaying dates as text.
 
if you need MM-DD-YYYY for your system. why not change the format when retrieving and displaying the date, ex. FORMAT(date.today,"dd-MM-YYYYY") or date.today.tostring("dd-MM-YYYY") and it makes a lot more sense than changing the actual date format on user's PC time right?
 
Thanks for your responses everyone! Firstly, it looks like I messed up my individual post by saying I wanted to convert MM-DD-YYYY to DD-MM-YYYY, it was actually the other way around.

@jmcilhinney - The main reason I'm to convert the date is because this particular sub pulls a list from the internet. The list is located at xxxxxxxxx.com/MM-DD-YYYY.txt and when I try using the computer default date it seams to format it as xxxxxxxx.com/DD-MM-YYYY.txt

@rjgagui - Thank you for the suggestion, I will definitely try this out because it looks like what I was going for. I don't want the user to need to mess with their clock, I just wanna make sure no matter how their computer it setup, it will always make it MM-DD-YYYY.

Thanks everyone!
 
you may try this

Imports System.Threading
Imports System.Globalization
Before the Public Class

And at the Form Load
Add this line >> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-GB", False)
 
Back
Top