[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] COMPARE DATE



Thank you Bob.

Bob Stone wrote:
> 
> i'm not sure how you're getting date_compare to be an 8 digit number, but I
> would think your date variable would be a string.  Lets assume its a static
> string that you've set somewhere else (or you can set it up however you
> want).
> 
> let $compare_date = '2004-11-19 15:51:32'
> 
> begin-select
> to_char(sysdate,'YYYY-MM-DD HH24:MI:SS')   &date
>    let $sysdate = &date
> from dual
> end-select
> 
> if $compare_date > $sysdate
>   do subprocedure_a
> end-if
> 
> The date edit-mask you use isn't important, just so it's the same throughout
> the SQR (and it helps if it's the same through all SQRs).  You could use
> 'YYYY-MM-DD' without the time part.
> 
> to_char(sysdate,'YYYY-MM-DD HH24:MI:SS')
> to_date('2004-10-20 14:01:19', 'YYYY-MM-DD HH24:MI:SS')  <-- for comparisons
> in DB.
> 
> Now, if you're saying that you start with a number (i dont know why your
> date would be a number, but lets say it is) I might move the sysdate to a
> $var with edit mask to get rid of all non-numeric parts of the date, then
> move to a #nbr and compare.
> 
> let #compare_date = 20050101
> 
> begin-select
> to_char(sysdate, 'YYYYMMDD)     &date
>    let $sysdate = &date
>    move $sysdate to #sysdate
> from dual
> end-select
> 
> if #compare_date > #sysdate
>   do subprocedure_a
> end-if.
> 
> -----Original Message-----
> From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
> [mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
> Chuyen Do
> Sent: Friday, November 19, 2004 3:34 PM
> To: sqr-users@sqrug.org
> Subject: [sqr-users] COMPARE DATE
> 
> Please HELP me the syntax:
> 
> #DATE_to_be_compared = 20041119
> 
> if #DATE_to_be_compared > sysdate !it means date at the time the
> program    do ..                          ! is running.
> end-if
> 
> I don't know the reserved name for sysdate
> 
> Thanks
> Chuyen Do
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users