[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

regional settings - ASP and IIS

Posted on 2008-10-01
2
Medium Priority
?
705 Views
Last Modified: 2012-05-05
How will IIS treat the regional language setting ? I have a web app, within the asp page, I have certain date fields. These are bound to datetime fields (ado types) in com objects. When a user enters 01/02/2008 and the regional setting is mm/dd/yyyy then it will be sent
to sql server as January 02 2008. My question is what will happen if a user logged from UK saves a record ? Will this be February 1st 2008 (dd/mm/yyyy) in the business object? These are com dlls. My webserver control panel regional setting has a format of mm/dd/yyyy.
0
Comment
Question by:tech_question
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
slamhound earned 2000 total points
ID: 22621052
This is always a big issue as I'm Australian (dd/mm/yyyy) and MS defaults everything to the US date format (mm/dd/yyyy) and I've developed a site for selling products to 15 different countries. I've found the best thing to do is to pass all dates through a function that forces their format. Two that I use regularly are included below:

Public Function DateToSQL( strDate )
      ' Takes date of form D/M/YYYY and converts to YYYY-MM-DD format for SQL use
      Dim aDate
            
      aDate = Split( strDate, "/" )
      
      If Len( aDate(1) ) = 1 Then
            aDate(1) = "0"& aDate(1)
      End If
      If Len( aDate(0) ) = 1 Then
            aDate(0) = "0"& aDate(0)
      End If
      
      DateToSQL = ""& aDate(2) &"-"& aDate(1) &"-"& aDate(0)
      
End Function

Public Function ForceDate()
    ForceDate = Day(Date()) & "/" & Month(Date()) & "/" & Year(Date())
End Function

On your site, you need to either tell the user how to enter the date which many people are fine with because the Internet is so international::
Birth Date: ______ (mm/dd/yyyy)

Or you need to check some browser variables of the user to estimate the country they are from and revamp your site to match that format. This is a very convoluted method and there's no promise that you will pick the right region or that the user will enter the date guessing at -your- date format.

So I suggest use the above code and just request the user enter one format and you show them the same format back.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question