Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Months between dates ?

by shadowsong (Pilgrim)
on Jun 10, 2019 at 08:04 UTC ( [id://11101188]=note: print w/replies, xml ) Need Help??


in reply to Months between dates ?

Hi bgroper

Although we love doing stuff in perl – if it's all the same, why not adjust your query so that your result set contains only that which you're interested in? a la SELECT statement below:

-- table set up CREATE TABLE test( test_id INTEGER ,date_tstamp TIMESTAMP NOT NULL DEFAULT LOCALTIMESTAMP ,CONSTRAINT test_test_id_pkey PRIMARY KEY (test_id) ); INSERT INTO test VALUES (1,now()) ,(2,now()) ,(3,now()) ,(4,now() + INTERVAL '60 days') ,(5,now() + INTERVAL '70 days') ; -- select statement SELECT date_tstamp FROM test WHERE date_tstamp > (now() + INTERVAL '59 days');

Best regards,
Shadowsong

Replies are listed 'Best First'.
Re^2: Months between dates ?
by bgroper (Novice) on Jun 10, 2019 at 09:12 UTC
    Thanks for the excellent suggestion.
    I agree, its much easier to do this with the SELECT statement, and then simply show the *Alert* if SELECT returns any result/s.
    Nice. :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11101188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found