New topic: How to know date format?
<http://forums.realsoftware.com/viewtopic.php?t=46480> Page 1 of 1 [ 8 posts ] Previous topic | Next topic Author Message tseyfarth Post subject: How to know date format?Posted: Mon Jan 07, 2013 7:38 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 807 Hello All, I had a problem today where I was doing a bit of a show and tell demo using skype. My customer was in the UK and I am in America. My problem was with the license and the dates assigned within the license. The customer in the UK, uses a different date format than we do in the US. Is there a way to programatically know what the system date format is? Thank you ! Tim Top timhare Post subject: Re: How to know date format?Posted: Mon Jan 07, 2013 8:43 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11951 Location: Portland, OR USA The typical approach is to create a date object and set it to known values, then check the resulting string representation to see where they fall. dim d as new date d.month = 11 d.day = 22 if left(d.ShortDate, 2) = "11" then // US elseif left(d.ShortDate, 2) = "22" then // UK else // ??? end Top ktekinay Post subject: Re: How to know date format?Posted: Mon Jan 07, 2013 9:22 pm Joined: Mon Feb 05, 2007 5:21 pm Posts: 339 Location: New York, NY You can also use plugins to determine the locale. _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top tseyfarth Post subject: Re: How to know date format?Posted: Mon Jan 07, 2013 11:10 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 807 Thanks for the response guys. ktekinay, I think you got it closer to the real question. So are there any System Objects that can be accessed to determine the locale? I did, btw, change the way the license is read, so that it is always reading in the same order - SQLDATE. I had not done this before, but I changed the code to perform this way, then changed my computer to UK and back, all works much better now! Nothwithstanding that, knowing the locale, would be helpful for other areas of my project too... Thanks again guys! Tim Top npalardy Post subject: Re: How to know date format?Posted: Tue Jan 08, 2013 9:38 am Real Software Engineer Joined: Sat Dec 24, 2005 8:18 pm Posts: 7650 Location: Canada, Alberta, Near Red Deer ktekinay wrote:You can also use plugins to determine the locale. The locale does not always dictate the date format though This is easy to demonstrate on OS X where you can set you locale to one thing then customize the date format _________________ My web site Great White Software RBLibrary.com REALbasic learning Top tseyfarth Post subject: Re: How to know date format?Posted: Tue Jan 08, 2013 12:05 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 807 True npalardy, So the broader question is, how to know the date and time formats and the language of the computer. Which plugin? Thanks, Tim Top jakuno Post subject: Re: How to know date format?Posted: Tue Jan 08, 2013 12:47 pm Joined: Fri Aug 31, 2012 3:56 pm Posts: 57 on Mac try: Shell.Execute "defaults read com.apple.systempreferences AppleIntlCustomFormat" Top ktekinay Post subject: Re: How to know date format?Posted: Tue Jan 08, 2013 12:53 pm Joined: Mon Feb 05, 2007 5:21 pm Posts: 339 Location: New York, NY Monkeybread does this, as does Einhugur. Can't look up which ones right now. _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 8 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
