×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

calculate days until today

calculate days until today

calculate days until today

(OP)
Hello,
i'm a newbie with webfocus. The second report, I shall write, has to calculate with date. I have a field that contains a beginning date with timestamp. The format is A19. It looks like 2004-07-27-07.25.15.416780. I have to count the days from beginning date until "today". I don't know, how much reports I started without getting the right solution! Can you help me, please?
Thanks
Karin

RE: calculate days until today

Here's an example of how to do it. First, strip out the 'date' from the date-time stamp, using the EDIT function, then, use the YMD function, which calculates the difference between two legacy dates, in [Y]YMD format. To automatically insert today's date, use &YYMD.

If you're dealing with 'smart' dates, you can just subtract two dates to get the difference.

As an aside, the string you gave was 26 characters long; it won't fit into an A19.

CODE

DEFINE FILE CAR
-* the next line is just to get the value into a field
XDT/A26='2004-07-27-07.25.15.416780';
ADT/A8YYMD=EDIT(XDT,'9999$99$99');
DATEDIFF/I6 = YMD(ADT,'&YYMD');
END
TABLE FILE CAR
PRINT XDT ADT DATEDIFF
WHERE COUNTRY EQ 'ENGLAND'
END

RE: calculate days until today

(OP)
Hi focwizard,
great! It works!
Thanks
Karin

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close