Displaying Date From a Database Record

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Displaying Date From a Database Record

    Hi, Can anyone help??? I am trying to display the date that a record was
    posted to a database to an asp page but it appears in the wrong format i.e.
    Month/Day/Year and I want to be displayed as Day/Month/Year. Is there anyway
    to do this as the date is Dynamic Text and I cant see how this can be changed
    or if it is even possible. My Host says that as the server my site is stored
    on is in Germany the date is in this format and they cant change it as I am on
    a shared server. They are no help what so ever in giving me a solution
    so................ Any help would be great Many Thanks Adam

    aDAMFOX Guest

  2. Similar Questions and Discussions

    1. Only 1 record displaying?
      Hi, I have a problem with Dreamweaver MX2004. I create my page as defined by the tutorial; connect to to my SQL database fine, displaying all the...
    2. Displaying the newest record first..
      I know this is probably a brain dead question, but I can't remember how to display the latest database entry first, and the oldest entry last. Any...
    3. Displaying only a part of a record field
      I would like to output only a part of a record field which is returned by a query. For example the outputed text would look like: "Drawing has...
    4. displaying a particular record in a particular location
      Greetings, I am working with two recordsets and I wish to display the last record from one of those sets in a particular place on a page, and...
    5. Update Record only displaying first entry of database in the details page
      Update Record only displaying first entry of database in the details page. It will update the record, it seems for some reason no matter what...
  3. #2

    Default Re: Displaying Date From a Database Record

    In your bindings tab highlight the data field and use the dropdown box to
    apply the desired format next ot it.


    "aDAMFOX" <webforumsuser@macromedia.com> wrote in message
    news:cv5nim$bg8$1@forums.macromedia.com...
    > Hi, Can anyone help??? I am trying to display the date that a record was
    > posted to a database to an asp page but it appears in the wrong format
    > i.e.
    > Month/Day/Year and I want to be displayed as Day/Month/Year. Is there
    > anyway
    > to do this as the date is Dynamic Text and I cant see how this can be
    > changed
    > or if it is even possible. My Host says that as the server my site is
    > stored
    > on is in Germany the date is in this format and they cant change it as I
    > am on
    > a shared server. They are no help what so ever in giving me a solution
    > so................ Any help would be great Many Thanks Adam
    >

    Anthony Brown Guest

  4. #3

    Default Re: Displaying Date From a Database Record

    there are formatting codes that one can apply using behaviors in dreamweaver,
    but I prefer to format the date in the SQL. If you are going against SQL
    Server, you can use convert(VARCHAR(10), tblname.datetime_fldname, 1) for
    example. Hope this helps. Rich McCrea

    RichMcCrea Guest

  5. #4

    Default Re: Displaying Date From a Database Record

    If you had control of the database, you could most likely set it to display the
    autodate any way you saw fit. What database type are you using? Perhaps it's
    possible to alter the data format for JUST your tableset in the db or some such
    thing. Was this even an autodate field or is this user-entered date data? If
    it's user entered, then you could simply break the date components out - month
    field, day field, year field, and have much greater access over the resulting
    format HTH Bill

    Billium99 Guest

  6. #5

    Default Re: Displaying Date From a Database Record

    Thanks for the ideas, I tried the Bindings Tab when i select the date
    datafield the Format title bar (Where it says Source then Binding then Format I
    guess) is not highlighted so i dont seem to be able to change this. The
    Database I am using is MS MSQL and the way the date is submitted is from my asp
    page using Now function. Before when i tried to submit a date using this
    function it was throwing up errors as on the 28/01/2005 (British Date Format)
    the sql database said there is no 28th month (as the European format is
    Month/Day/Year). My ISP gave me this code to place in an asp page called
    global <SCRIPT LANGUAGE=VBScript RUNAT=Server> Sub Session_OnStart 'Global
    session config's Session.LCID=1033 End Sub </SCRIPT> so i guess this
    converts the date into the correct format for the SQL database??? i.e.
    month/day/year ... but i am not sure. How would I use this
    convert(VARCHAR(10), tblname.datetime_fldname, 1) and where would I put it in
    my page Sorry to know absolutely nothing about programming Thanks Again
    Adam

    aDAMFOX Guest

  7. #6

    Default Re: Displaying Date From a Database Record

    I HAVE FOUND THE ANSWER... On the page displayig the records use this line of
    code <%Session.LCID = 2057%> Which sets the format to be bitish and
    displaying the date as day / month / year Thanks for the help anyway Adam

    aDAMFOX Guest

  8. #7

    Default Displaying Date From a Database Record

    Hi I posted a question about displaying a date in an asp page with the
    dynamic data coming from an MS SQL database. The date is displayed
    month/day/year and I want the date to be displayed Day/Month/Year. Some
    people gave me some help and i thought i had found the solution so marked the
    question answered then found out I was wrong and so have created a new thread.
    I tjhought that is i use the code : <%Session.LCID = 2057%> it would change the
    date and it does to the format Day/Month/Year but now when i try and search for
    records by their date posted it throws up an error saying value out of range.
    as it is the 20/2/2005 and there is no 20 month (the sql database is set up as
    Month Day Year). A User said to do this but i cant under stand what i a,m
    menat to do with code or how it works 'there are formatting codes that one can
    apply using behaviors in dreamweaver, but I prefer to format the date in the
    SQL. If you are going against SQL Server, you can use convert(VARCHAR(10),
    tblname.datetime_fldname, 1) for example. ' Can anyone help me Thanks Adam

    aDAMFOX Guest

  9. #8

    Default Re: Displaying Date From a Database Record

    SQL server by default sets the User language to US English which set the Date
    to MM/dd/YYYY.

    You can set the User Language to UK English which means it will except Dates
    as DD/MM/YYYY this is something I always request or do myself on the live
    database.

    You could however when searching using the ISO Date format of YYYY-MM-DD which
    will normally find the correct date however it is stored.

    You could also when you search change the Search date of dd/mm/yyyy to the ISO
    standard, so you don't have to enter it in the Search field.

    varDate = Request("txtDate")

    Dim ISODate
    SDate = DatePart("d", varDate)
    If SDate < 10 Then
    SDate = "0" & SDate
    End If
    SMonth = DatePart("m", varDate)
    If SMonth < 10 Then
    SMonth = "0" & SMonth
    End If
    SYear = DatePart("yyyy", varStartDate)
    ISODate = SYear & "-" & SMonth & "-" & SDate

    You would put this code at the top of your results page before the recordset
    which checks for the date records.


    Originally posted by: aDAMFOX
    Hi I posted a question about displaying a date in an asp page with the
    dynamic data coming from an MS SQL database. The date is displayed
    month/day/year and I want the date to be displayed Day/Month/Year. Some
    people gave me some help and i thought i had found the solution so marked the
    question answered then found out I was wrong and so have created a new thread.
    I tjhought that is i use the code : <%Session.LCID = 2057%> it would change the
    date and it does to the format Day/Month/Year but now when i try and search for
    records by their date posted it throws up an error saying value out of range.
    as it is the 20/2/2005 and there is no 20 month (the sql database is set up as
    Month Day Year). A User said to do this but i cant under stand what i a,m
    menat to do with code or how it works "there are formatting codes that one can
    apply using behaviors in dreamweaver, but I prefer to format the date in the
    SQL. If you are going against SQL Server, you can use convert(VARCHAR(10),
    tblname.datetime_fldname, 1) for example. " Can anyone help me Thanks Adam



    CarlGrint Guest

  10. #9

    Default Re: Displaying Date From a Database Record

    Hi, I tried to put your code in and it gave this error wheni search ed using
    the date Microsoft OLE DB Provider for SQL Server error '80040e07' The
    conversion of a char data type to a datetime data type resulted in an
    out-of-range datetime value. /AadvancedSearchTestingPage.asp, line 88 I
    understand what the code is doing splitnig the date and then into yy - mm- dd
    but i dont see what the first line is doing varDate = Request('txtDate') I
    can see it is declaring a variable varDate but what is Request txtDate is that
    getting it from the form?? Thanks Adam

    aDAMFOX Guest

  11. #10

    Default Re: Displaying Date From a Database Record

    Yes, it takes the Date from a form element from a field called txtDate or a URL
    value called txtDate.

    Using Request means it will look for either Form value or URL value.


    Originally posted by: aDAMFOX
    Hi, I tried to put your code in and it gave this error wheni search ed using
    the date Microsoft OLE DB Provider for SQL Server error '80040e07' The
    conversion of a char data type to a datetime data type resulted in an
    out-of-range datetime value. /AadvancedSearchTestingPage.asp, line 88 I
    understand what the code is doing splitnig the date and then into yy - mm- dd
    but i dont see what the first line is doing varDate = Request("txtDate") I
    can see it is declaring a variable varDate but what is Request txtDate is that
    getting it from the form?? Thanks Adam



    CarlGrint Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139