Disappearing date (ASP, JS)

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

  1. #1

    Default Disappearing date (ASP, JS)

    Hi,

    I have a terribly simple problem, but can't see the (probably obvious)
    solution:

    I have a listbox with date entries. When I first wanted to get the entry
    selected by the user, I needed actually to store it in a session
    variable, so I did it that way:
    var compVersion = Request.Form("compVers");
    Session("CompVersion") = compVersion;

    This promptly generated an error, telling me that one cannot store an
    implicit variable in a session variable, or something like that. OK, I
    thought, I'll use trick 57, and changed it to:
    var compVersion = Request.Form("compVers");
    Session("CompVersion") = Date(compVersion);

    No error anymore, but... when I know print the content of
    Session.Contents("CompVersion"), I get... "undefined", although a print
    of the variable after the first code line gives me exactly the data as I
    expect it !!!

    So, how do I save my date entry in a session variable, so that I can use
    it later as a date again ?

    Thanks for help
    Bernard
    bthouin Guest

  2. Similar Questions and Discussions

    1. JSObject returns wrong date. How can Iextract correct date from digital signature?
      I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and...
    2. #39245 [NEW]: date function generate wrong date with 1162083600 timestamp
      From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ...
    3. converting date into database date format(newbie)
      Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?>
    4. How do I manipulate a date variable to a specific date array?
      Hi, I use the getdate() function to return today's date in an array. I do this as I need to separate the day/month/year as to display them in a...
  3. #2

    Default Re: Disappearing date (ASP, JS)

    My suggestion to newbies is to use VB Script, a bit easier to get to grips
    with than Javascript. With JS, you need to cast the variable to a string. eg

    Session("CompVersion") = String(Request.Form("compVers"))

    --
    Jules
    [url]http://www.charon.co.uk/charoncart[/url]
    Charon Cart 3
    Shopping Cart Extension for Dreamweaver MX/MX 2004



    Julian Roberts Guest

  4. #3

    Default Re: Disappearing date (ASP, JS)

    Julian Roberts wrote:
    > My suggestion to newbies is to use VB Script, a bit easier to get to grips
    > with than Javascript. With JS, you need to cast the variable to a string. eg
    >
    > Session("CompVersion") = String(Request.Form("compVers"))
    >
    Ok, Jules, that's what I did, but then, when I pass that session
    variable to the next page, which is in VBScript (!), how do I turn that
    string back to a date ? CDate(string) gives me an error...

    Bernard
    bthouin Guest

  5. #4

    Default Re: Disappearing date (ASP, JS)

    Julian Roberts wrote:
    > My suggestion to newbies is to use VB Script, a bit easier to get to grips
    > with than Javascript. With JS, you need to cast the variable to a string. eg
    >
    > Session("CompVersion") = String(Request.Form("compVers"))
    >
    Some more info:
    - I originally entered the date in SQLServer in a date field as
    "01.02.2005" (1st of Feb 2005, European notation)
    - the value read from SQLServer looks like this: "Tue Feb 1 00:00:00
    UTC+0100 2005"
    - this, put into a string in the session variable is NOT recognized as a
    valid date by the VBScript IsDate and CDate functions !!! So much for
    compatibility...

    Does this mean I now have to split that string and handle it myself ? I
    find that outrageous !

    Bernard
    bthouin 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