Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

(maverick) Re: Date::Calc Module

by maverick (Curate)
on Dec 29, 2001 at 22:24 UTC ( #135137=note: print w/replies, xml ) Need Help??


in reply to Date::Calc Module

Most databases have date manipulation functions built in. If you're using mysql for example (your database probably has different commands for this) you write your sql query as:
SELECT something FROM some_table WHERE TO_DAYS(NOW()) - TO_DAYS(date_column) = 10;
That would return all the matching rows where date_column is 10 days less that today's date. NOW give you the current date, TO_DAYS converts the date to a number of days so that you can do a subtraction. This would be significantly faster than selecting out every row and then doing the date manipulation stuff in perl.

HTH (I can provide a more complete example if you want)

/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

Replies are listed 'Best First'.
Re: (maverick) Re: Date::Calc Module
by skirrow (Novice) on Dec 29, 2001 at 22:55 UTC
    Hi, I'm using a flat-file text db but thanks anyway. :o) - Neil

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://135137]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2018-06-18 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (109 votes). Check out past polls.

    Notices?