Time Formatting in ASP

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

  1. #1

    Default Time Formatting in ASP

    Hey All ...

    I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the data is
    coming from a third party, which I get as a CSV and import into the database,
    updating it weekly.

    Since I have no control over how the data is collected, I'm not sure how to fix
    this problem, but here it is.

    This is a database of movies and among the many fields I import is one for the
    movie's length, expressed in HH:MM:SS. This comes into the Access DB as a
    Date/Time format, which means all the dates, displayed raw in the DB, look like
    "12:09:52 AM". Displaying it to the client as HH:MM:SS is no problem.

    But in an update form, which we'll use to correct errors (and there always seem
    to be errors in the running time of the movie), I can't figure out how to
    display it in the HH:MM:SS format and have it submit and without throwing a data
    type mismatch error.

    Converting the field to a text type is out of the question at this point, so I
    know I need to do some type of string manipulation prior to update. However, I'm
    lost

    Any ideas?

    Thanks.

    --
    -----------------------------------------------------
    joe ruggeri
    web designer
    JFmedia newport, ri

    -----------------------------------------------------


    joe ruggeri Guest

  2. Similar Questions and Discussions

    1. CFMX7.0.1 Administrator date time issue showing 13hrsbehind server time
      I am running a W2k SP4 box that has been upgraded from CFMX6 to CFMX7.0.1. The CFMX7.0.1 server is showing the date on the Server Settings >...
    2. Formatting a length of time
      Maybe I haven't looked hard enough but I am having trouble formatting a formatting a length of time rg. the length of a song or a race.. The...
    3. Formatting time as a duration?
      I have data in a database that lists duration time (hh:mm). If I give it a string format of {0:t} (short time), a value of 0:55 (55 minutes) shows...
    4. formatting date on datagrid to get rid of time
      Hmm, how does the label work with the DataGrid? Anyway, what does the label look like, if not associated with the DataGrid? Will it display the date...
  3. #2

    Default Re: Time Formatting in ASP

    Shouldn't be a problem. Please show your code.

    "joe ruggeri" <joerugg@nospam.cox.net> wrote in message
    news:d00e4f$60s$1@forums.macromedia.com...
    > Hey All ...
    >
    > I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the
    data is
    > coming from a third party, which I get as a CSV and import into the
    database,
    > updating it weekly.
    >
    > Since I have no control over how the data is collected, I'm not sure how
    to fix
    > this problem, but here it is.
    >
    > This is a database of movies and among the many fields I import is one for
    the
    > movie's length, expressed in HH:MM:SS. This comes into the Access DB as a
    > Date/Time format, which means all the dates, displayed raw in the DB, look
    like
    > "12:09:52 AM". Displaying it to the client as HH:MM:SS is no problem.
    >
    > But in an update form, which we'll use to correct errors (and there always
    seem
    > to be errors in the running time of the movie), I can't figure out how to
    > display it in the HH:MM:SS format and have it submit and without throwing
    a data
    > type mismatch error.
    >
    > Converting the field to a text type is out of the question at this point,
    so I
    > know I need to do some type of string manipulation prior to update.
    However, I'm
    > lost
    >
    > Any ideas?
    >
    > Thanks.
    >
    > --
    > -----------------------------------------------------
    > joe ruggeri
    > web designer
    > JFmedia newport, ri
    >
    > -----------------------------------------------------
    >
    >

    CMBergin Guest

  4. #3

    Default Re: Time Formatting in ASP w/CODE

    Hey All ...

    I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the data
    is coming from a third party, which I get as a CSV and import into the
    database, updating it weekly.

    Since I have no control over how the data is collected, I'm not sure how to
    fix this problem, but here it is.

    This is a database of movies and among the many fields I import is one for
    the movie's length, expressed in HH:MM:SS. This comes into the Access DB as
    a
    Date/Time format, which means all the dates, displayed raw in the DB, look
    like "12:09:52 AM". Through data farmatting, however, displaying it to the
    client as HH:MM:SS is no problem. (Display "12:36:00 AM" as military time
    (00:36:00) tells me the movie is 0 hrs, 36 minutes, 0 seconds long. Follow?)

    But in an update form, which we'll use to correct errors (and there always
    seem to be errors in the running times of movies), I can't figure out how to
    display it in the HH:MM:SS format in an INPUT field and have it submit
    without throwing a data type mismatch error.

    Converting the field to a text type is out of the question at this point, so
    I know I need to do some type of string manipulation prior to update.
    However, I'm lost ...

    Any ideas?

    Thanks.

    UPDATE query below:

    <%
    ' *** Update Record: set variables

    If (CStr(Request("MM_update")) = "update" And CStr(Request("MM_recordId"))
    <> "") Then

    MM_editConnection = MM_niff2005_STRING
    MM_editTable = "tblWABimports"
    MM_editColumn = "WABIDID"
    MM_recordId = "" + Request.Form("MM_recordId") + ""
    MM_editRedirectUrl = "wabListall.asp"
    MM_fieldsStr =
    "film|value|synopsis|value|AspectRatio|value|Forma ts_Shooting|value|Formats_
    Exhibition|value|Sound|value|Color|value|Runtime|v alue|director_Fname|value|
    director_Lname|value|director_company|value|direct or_addr1|value|director_ad
    dr2|value|director_city|value|director_state|value |director_zip|value|direct
    or_country|value|director_email|value|director_pho ne1|value|director_phone2|
    value|director_web|value|Submission_Fname|value|Pr oducer1_f_name|value|Submi
    ssion_Lname|value|Producer1_l_name|value|Submissio n_company|value|Producer1_
    company|value|Submission_address|value|Producer1_a ddress|value|Submission_ad
    dress2|value|Producer1_address2|value|Submission_c ity|value|Producer1_city|v
    alue|Submission_state|value|Submission_postal|valu e|Producer1_state|value|Pr
    oducer1_postal|value|Submission_country|value|Prod ucer1_country|value|Submis
    sion_email|value|Submission_phone1|value|Producer1 _email|value|Producer1_pho
    ne1|value|Submission_phone2|value|Producer1_phone2 |value|Submission_web|valu
    e|Producer1_web|value"
    MM_columnsStr =
    "Title|',none,''|Synopsis_3line|',none,''|AspectRa tio|',none,''|Formats_Shoo
    ting|',none,''|Formats_Exhibition|',none,''|Sound| ',none,''|Color|',none,''|
    Runtime|',none,NULL|Director1_Fname|',none,''|Dire ctor1_Lname|',none,''|Dire
    ctor1_company|',none,''|Director1_address1|',none, ''|Director1_address2|',no
    ne,''|Director1_city|',none,''|Director1_state|',n one,''|Director1_postal|',
    none,''|Director1_country|',none,''|Director1_emai l|',none,''|Director1_phon
    e1|',none,''|Director1_phone2|',none,''|Director1_ website|',none,''|Submissi
    on_Fname|',none,''|Producer1_f_name|',none,''|Subm ission_Lname|',none,''|Pro
    ducer1_l_name|',none,''|Submission_company|',none, ''|Producer1_company|',non
    e,''|Submission_address1|',none,''|Producer1_addre ss1|',none,''|Submission_a
    ddress2|',none,''|Producer1_address2|',none,''|Sub mission_city|',none,''|Pro
    ducer1_city|',none,''|Submission_state|',none,''|S ubmission_postal|',none,''
    |Producer1_state|',none,''|Producer1_postal|',none ,''|Submission_country|',n
    one,''|Producer1_country|',none,''|Submission_emai l|',none,''|Submission_pho
    ne1|',none,''|Producer1_email|',none,''|Producer1_ phone1|',none,''|Submissio
    n_phone2|',none,''|Producer1_phone2|',none,''|Subm ission_website|',none,''|P
    roducer1_website|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
    Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>


    And the INPUT field, which reads out of the "Runtime" field in the DB:

    <input name="Runtime" type="text" id="Runtime"
    value="<%=(rsWAB.Fields.Item("Runtime").Value)%>" size="20" />

    Which shows up on the client side as "12:36:00 AM" or some other time.


    Thanks ... jr


    --
    -----------------------------------------------------
    joe ruggeri
    web designer
    JFmedia newport, ri

    -----------------------------------------------------


    Joe Ruggeri Guest

  5. #4

    Default Re: Time Formatting in ASP w/CODE

    In your MM_columnsStr, there's a section like this:
    ....snip...Runtime|',none,NULL...snip...
    Change it to:
    Runtime|#,none,NULL

    "Joe Ruggeri" <joerugg@nospam.jfmedia.com> wrote in message
    news:d02h55$c27$1@forums.macromedia.com...
    > Hey All ...
    >
    > I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the
    data
    > is coming from a third party, which I get as a CSV and import into the
    > database, updating it weekly.
    >
    > Since I have no control over how the data is collected, I'm not sure how
    to
    > fix this problem, but here it is.
    >
    > This is a database of movies and among the many fields I import is one for
    > the movie's length, expressed in HH:MM:SS. This comes into the Access DB
    as
    > a
    > Date/Time format, which means all the dates, displayed raw in the DB, look
    > like "12:09:52 AM". Through data farmatting, however, displaying it to the
    > client as HH:MM:SS is no problem. (Display "12:36:00 AM" as military time
    > (00:36:00) tells me the movie is 0 hrs, 36 minutes, 0 seconds long.
    Follow?)
    >
    > But in an update form, which we'll use to correct errors (and there always
    > seem to be errors in the running times of movies), I can't figure out how
    to
    > display it in the HH:MM:SS format in an INPUT field and have it submit
    > without throwing a data type mismatch error.
    >
    > Converting the field to a text type is out of the question at this point,
    so
    > I know I need to do some type of string manipulation prior to update.
    > However, I'm lost ...
    >
    > Any ideas?
    >
    > Thanks.
    >
    > UPDATE query below:
    >
    > <%
    > ' *** Update Record: set variables
    >
    > If (CStr(Request("MM_update")) = "update" And CStr(Request("MM_recordId"))
    > <> "") Then
    >
    > MM_editConnection = MM_niff2005_STRING
    > MM_editTable = "tblWABimports"
    > MM_editColumn = "WABIDID"
    > MM_recordId = "" + Request.Form("MM_recordId") + ""
    > MM_editRedirectUrl = "wabListall.asp"
    > MM_fieldsStr =
    >
    "film|value|synopsis|value|AspectRatio|value|Forma ts_Shooting|value|Formats_
    >
    Exhibition|value|Sound|value|Color|value|Runtime|v alue|director_Fname|value|
    >
    director_Lname|value|director_company|value|direct or_addr1|value|director_ad
    >
    dr2|value|director_city|value|director_state|value |director_zip|value|direct
    >
    or_country|value|director_email|value|director_pho ne1|value|director_phone2|
    >
    value|director_web|value|Submission_Fname|value|Pr oducer1_f_name|value|Submi
    >
    ssion_Lname|value|Producer1_l_name|value|Submissio n_company|value|Producer1_
    >
    company|value|Submission_address|value|Producer1_a ddress|value|Submission_ad
    >
    dress2|value|Producer1_address2|value|Submission_c ity|value|Producer1_city|v
    >
    alue|Submission_state|value|Submission_postal|valu e|Producer1_state|value|Pr
    >
    oducer1_postal|value|Submission_country|value|Prod ucer1_country|value|Submis
    >
    sion_email|value|Submission_phone1|value|Producer1 _email|value|Producer1_pho
    >
    ne1|value|Submission_phone2|value|Producer1_phone2 |value|Submission_web|valu
    > e|Producer1_web|value"
    > MM_columnsStr =
    >
    "Title|',none,''|Synopsis_3line|',none,''|AspectRa tio|',none,''|Formats_Shoo
    >
    ting|',none,''|Formats_Exhibition|',none,''|Sound| ',none,''|Color|',none,''|
    >
    Runtime|',none,NULL|Director1_Fname|',none,''|Dire ctor1_Lname|',none,''|Dire
    >
    ctor1_company|',none,''|Director1_address1|',none, ''|Director1_address2|',no
    >
    ne,''|Director1_city|',none,''|Director1_state|',n one,''|Director1_postal|',
    >
    none,''|Director1_country|',none,''|Director1_emai l|',none,''|Director1_phon
    >
    e1|',none,''|Director1_phone2|',none,''|Director1_ website|',none,''|Submissi
    >
    on_Fname|',none,''|Producer1_f_name|',none,''|Subm ission_Lname|',none,''|Pro
    >
    ducer1_l_name|',none,''|Submission_company|',none, ''|Producer1_company|',non
    >
    e,''|Submission_address1|',none,''|Producer1_addre ss1|',none,''|Submission_a
    >
    ddress2|',none,''|Producer1_address2|',none,''|Sub mission_city|',none,''|Pro
    >
    ducer1_city|',none,''|Submission_state|',none,''|S ubmission_postal|',none,''
    >
    |Producer1_state|',none,''|Producer1_postal|',none ,''|Submission_country|',n
    >
    one,''|Producer1_country|',none,''|Submission_emai l|',none,''|Submission_pho
    >
    ne1|',none,''|Producer1_email|',none,''|Producer1_ phone1|',none,''|Submissio
    >
    n_phone2|',none,''|Producer1_phone2|',none,''|Subm ission_website|',none,''|P
    > roducer1_website|',none,''"
    >
    > ' create the MM_fields and MM_columns arrays
    > MM_fields = Split(MM_fieldsStr, "|")
    > MM_columns = Split(MM_columnsStr, "|")
    >
    > ' set the form values
    > For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    > MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    > Next
    >
    > ' append the query string to the redirect URL
    > If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    > If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
    > Request.QueryString <> "") Then
    > MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    > Else
    > MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    > End If
    > End If
    >
    > End If
    > %>
    >
    >
    > And the INPUT field, which reads out of the "Runtime" field in the DB:
    >
    > <input name="Runtime" type="text" id="Runtime"
    > value="<%=(rsWAB.Fields.Item("Runtime").Value)%>" size="20" />
    >
    > Which shows up on the client side as "12:36:00 AM" or some other time.
    >
    >
    > Thanks ... jr
    >
    >
    > --
    > -----------------------------------------------------
    > joe ruggeri
    > web designer
    > JFmedia newport, ri
    >
    > -----------------------------------------------------
    >
    >

    CMBergin Guest

  6. #5

    Default Re: Time Formatting in ASP w/CODE

    Nice catch! Thanks. It did the trick.

    - jr

    "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    news:d04e94$b59$1@forums.macromedia.com...
    > In your MM_columnsStr, there's a section like this:
    > ...snip...Runtime|',none,NULL...snip...
    > Change it to:
    > Runtime|#,none,NULL
    >
    > "Joe Ruggeri" <joerugg@nospam.jfmedia.com> wrote in message
    > news:d02h55$c27$1@forums.macromedia.com...
    > > Hey All ...
    > >
    > > I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the
    > data
    > > is coming from a third party, which I get as a CSV and import into the
    > > database, updating it weekly.
    > >
    > > Since I have no control over how the data is collected, I'm not sure how
    > to
    > > fix this problem, but here it is.
    > >
    > > This is a database of movies and among the many fields I import is one
    for
    > > the movie's length, expressed in HH:MM:SS. This comes into the Access DB
    > as
    > > a
    > > Date/Time format, which means all the dates, displayed raw in the DB,
    look
    > > like "12:09:52 AM". Through data farmatting, however, displaying it to
    the
    > > client as HH:MM:SS is no problem. (Display "12:36:00 AM" as military
    time
    > > (00:36:00) tells me the movie is 0 hrs, 36 minutes, 0 seconds long.
    > Follow?)
    > >
    > > But in an update form, which we'll use to correct errors (and there
    always
    > > seem to be errors in the running times of movies), I can't figure out
    how
    > to
    > > display it in the HH:MM:SS format in an INPUT field and have it submit
    > > without throwing a data type mismatch error.
    > >
    > > Converting the field to a text type is out of the question at this
    point,
    > so
    > > I know I need to do some type of string manipulation prior to update.
    > > However, I'm lost ...
    > >
    > > Any ideas?
    > >
    > > Thanks.
    -- snip --


    Joe Ruggeri Guest

  7. #6

    Default Re: Time Formatting in ASP w/CODE

    No problem. :)

    "Joe Ruggeri" <joerugg@NOSPAM.jfmedia.com> wrote in message
    news:d080ug$b6c$1@forums.macromedia.com...
    > Nice catch! Thanks. It did the trick.
    >
    > - jr
    >
    > "CMBergin" <NoHarvestForYou@NoSpam.org> wrote in message
    > news:d04e94$b59$1@forums.macromedia.com...
    > > In your MM_columnsStr, there's a section like this:
    > > ...snip...Runtime|',none,NULL...snip...
    > > Change it to:
    > > Runtime|#,none,NULL
    > >
    > > "Joe Ruggeri" <joerugg@nospam.jfmedia.com> wrote in message
    > > news:d02h55$c27$1@forums.macromedia.com...
    > > > Hey All ...
    > > >
    > > > I'm developing in ASP/VBScript w/ an Access 2000 DB. The source of the
    > > data
    > > > is coming from a third party, which I get as a CSV and import into the
    > > > database, updating it weekly.
    > > >
    > > > Since I have no control over how the data is collected, I'm not sure
    how
    > > to
    > > > fix this problem, but here it is.
    > > >
    > > > This is a database of movies and among the many fields I import is one
    > for
    > > > the movie's length, expressed in HH:MM:SS. This comes into the Access
    DB
    > > as
    > > > a
    > > > Date/Time format, which means all the dates, displayed raw in the DB,
    > look
    > > > like "12:09:52 AM". Through data farmatting, however, displaying it to
    > the
    > > > client as HH:MM:SS is no problem. (Display "12:36:00 AM" as military
    > time
    > > > (00:36:00) tells me the movie is 0 hrs, 36 minutes, 0 seconds long.
    > > Follow?)
    > > >
    > > > But in an update form, which we'll use to correct errors (and there
    > always
    > > > seem to be errors in the running times of movies), I can't figure out
    > how
    > > to
    > > > display it in the HH:MM:SS format in an INPUT field and have it submit
    > > > without throwing a data type mismatch error.
    > > >
    > > > Converting the field to a text type is out of the question at this
    > point,
    > > so
    > > > I know I need to do some type of string manipulation prior to update.
    > > > However, I'm lost ...
    > > >
    > > > Any ideas?
    > > >
    > > > Thanks.
    > -- snip --
    >
    >

    CMBergin 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