Results 1 to 3 of 3

Thread: Dates

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    I'm having great trouble with entering dates onto my web page that will then send the information to my SQL database.

    I want to be able to enter in the format of dd/mm/yy
    But this keeps returning errors.

    So I tried mm/dd/yy and this works fine, but whe redisplay on the web it comes out as mm/dd/yy, which is no good to me.

    I really would like to display it as dd/mm/yyyy.

    How can I achieve this as its really starting to bug me.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    the reaon this is happening is becuase sql server get's it information from the local settings of the server. the actual computer that has sql running on it will be set up as american or the likes.

    To change it go into control panel in windows and click on regional settings and make sure the local is English(United Kingdom).

    If you haven't got access to this (ie your using an ISP)
    I dont think you can do much about it as the formatdatetime function uses it ingormation from the local system as well

    hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Guest
    You could make yourself your own date formatting function using the Day(), Month(), and Year() functions. It might look something like this:

    Code:
    <%
    Function DisplayDate(DateValue)
      Dim strReturn
      Dim strDay
      Dim strMonth
    
      strDay = Day(DateValue)
      If Len(strDay) = 1 Then
        strDay = "0" & strDay
      End If
    
      strMonth = Month(DateValue)
      If Len(strMonth) = 1 Then
        strMonth = "0" & strMonth
      End If
    
      strReturn = strDay & "/" & strMonth & "/" & Year(DateValue)
    
      DisplayDate = strReturn
    End Function
    %>
    And call is from within your ASP code like so:
    Code:
    Response.Write "<P>" & DisplayDate(Date) & "</P>" & vbcrlf
    Cheers,
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width