MM/DD/YY or DD/MM/YY ??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: MM/DD/YY or DD/MM/YY ??

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    MM/DD/YY or DD/MM/YY ??

    [Originally posted by Danopolitan]

    I've created a daily agenda program which many people are currently using, but for some reason I kept receiving notes from people saying that their monthly calendar started from the wrong dates. I compile these calendars simply by using Weekday(the first of the month stored in a date variable here). Now this approach works fine on most computers, but not on others. For example, on my computer, the program would start October on a Tuesday (weekday value 3), yet others will start on a Thursday. This was entirely confusing until I looked at the date itself. My computer was registering 10/01/2002 as Tuesday, but if you reverse the day and month, you find January 10th is a Thursday. Therefore I discovered this may be my problem.
    Now to my question: Why do some systems read the date differently? I've encountered the problem on all operating systems. How can I adapt my date readings for this change?
    Thanks to anyone who can help,
    Dan

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:MM/DD/YY or DD/MM/YY ??

    [Originally posted by Greg DeBacker]

    This problem crops up all the time, and how to solve it is not an easy answer. The Contol Panal applet "Reginoal Settings" determines things like date and currency formats. In some systems the users prefernce is stored in the Registry and in others it is stored in the Win.ini file or the System.ini (I forget which one) You could read that information and change your code accordingly. I hope this helps.

    Grex

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:MM/DD/YY or DD/MM/YY ??

    [Originally posted by sajju]

    hi,
    though i am unable to understand your problem, but as far as DD/MM/YYYY˙ is concern, you need to for the date, eg format(date, "DD/MM/YYYY"), and to further avoid confusion with DD and MM, replace MM with MMM(eg Oct). hope this will slove your problem.
    sajju

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:MM/DD/YY or DD/MM/YY ??

    [Originally posted by Ed Ardzinski]

    If you read the system date you should be able to format it anyway you want.˙ It sounds like you are always formatting one way, but should format it based on the regional settings.

    Not that I even use VB much anymore...but in my forays using text output and the Input# function, I remeber that there was a bit of discussion about date data nad regional settings.˙ But I don't think it mentioned how to determine the regional data setting...only how to create import/export data files that was insensitive to it.

    Another possible approach I would take is to try and create your own date data type...it's really not that hard.˙ MicroSoft, othr products that I work with, store dates as a number.˙ You can choose your own "start date", can make your mind up if you think that the day 0, or even negative days, make any sense.˙ The rules for our calander are a little odd, but not too complicated.

    Check the help files for Input#, and subjects regarding date formatting...

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:MM/DD/YY or DD/MM/YY ??

    [Originally posted by Andon K.]

    Looks like you wrote your software with one set of Regional Settings (date format and delimiters) and on some of your end users computers there is a different one.

    There are some API functions that give you the current regional settings for date and number formats so you can adjust your application accordingly.

    If you are really interested, let me know. I think I have some code that may help you, but I must dig into my archives.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center