OK This has been bugging me

Results 1 to 2 of 2

Thread: OK This has been bugging me

  1. #1
    Tyler Morris Guest

    Default OK This has been bugging me

    With this code:<BR><BR>Session("thedate") = Now<BR><BR>&#039 user comes back to page 10 minutes later...<BR><BR>Response.Write Session("thedate") &#060; Now<BR>Response.Write Session("thedate") &#062; Now<BR>Response.Write Session("thedate") = Now<BR><BR>Does ASP compare "Now" strings the way they should be compared? Checking year, then month, then day, hour, minute, second, and so on? Or does it treat a string in "now" format as just another string? Can I check to see if one date is greater than other etc. in this manner or do I have to write the algorithm which breaks down the string myself?

  2. #2
    Join Date
    Dec 1969

    Default RE: OK This has been bugging me

    Actually, if you did<BR><BR>Response.Write VarType( Date() ) <BR>or<BR>Response.Write VarType( Now() ) <BR><BR>and looked at the docs for VarType, you&#039d realize that Date() and Now() are *NOT* strings that display date and time info. Instead, they are a special data type called (surprise!) DATE.<BR><BR>Internally, a DATE value is stored as a double precision floating point number (like DOUBLE or CDbl or...). And it actually represents the number of SECONDS since some zero point back in history. (It might be 1/1/0001, but I&#039ve never tried to find out.)<BR><BR>Then, when you ask to display that value, VBS has to convert those number of seconds into a String that a silly old human can read. Almost forgot! The DATE value also has to carry a value to tell itself whether it represents a full date/time or just a date. Dunno how that works, internally.<BR><BR>ANYWAY... The point is that since what is actually stored there is the number of seconds, it&#039s not surprising that you can do comparisons between two values and get the right answer.<BR><BR>The details in this description (esp. how it knows the difference between a date only and a date/time) may be wrong, but the general concept is right.<BR><BR>

Posting Permissions

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