Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23043

Re: Confusion over date

Newsgroups comp.lang.javascript
Subject Re: Confusion over date
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <McWdncG4nIe8lmXPnZ2dnUVZ_tednZ2d@westnet.com.au>
Date 2014-02-10 00:54 +0100
Message-ID <XnsA2D0942C480Ceejj99@194.109.133.133> (permalink)

Show all headers | View raw


Andrew Poulos <ap_prog@hotmail.com> wrote on 10 feb 2014 in 
comp.lang.javascript:

> I'm using jscript in classic ASP to query an SQLServer for a date
>    var expiry = rs.Fields("ExpiryDay").value;
> 
> If I put the variable into the page with
>    <%= expiry %>
> I get
>    Mon Feb 10 09:58:15 UTC+1100 2014
> 
> Yet this
> 
> if (expiry) {

Some say you need to explicitly create a Date object.

var expiry = new Date(rs("ExpiryDay").Value);

Try some debugging with this.


>    // has date
>} else {
>    // does NOT have date
>}
> 
> keeps returning "does NOT have date".

Not strictly true

// does NOT have date

won't return a thing.

> I thought that only
>    undefined, null, NaN, 0, "", and false
> were falsey, so why is 'expiry' false?



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Confusion over date Andrew Poulos <ap_prog@hotmail.com> - 2014-02-10 10:09 +1100
  Re: Confusion over date "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-02-10 00:54 +0100
    Re: Confusion over date Andrew Poulos <ap_prog@hotmail.com> - 2014-02-10 14:30 +1100
      Re: Confusion over date "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-02-10 09:56 +0100
        Re: Confusion over date Andrew Poulos <ap_prog@hotmail.com> - 2014-02-10 21:16 +1100

csiph-web