Subtract from date

823 views
Skip to first unread message

peshwanth vummity

unread,
Apr 11, 2019, 3:07:02 AM4/11/19
to robotframework-users
Hi All, 


I need help to subtract date in my application.

Scenario: Need to check application shouldn't more than 30 days.

1) Application date I'll present in application need to get that date
2)Need to get current date
3)Subtract application date and current data and need to get date count between that 

Regards,
Peshwanth

zhuy...@gmail.com

unread,
Apr 11, 2019, 5:28:52 AM4/11/19
to robotframework-users
Hi
Please see builtin Datetime library which provides the ability to manipulate date and time


Regards

在 2019年4月11日星期四 UTC+8下午3:07:02,peshwanth vummity写道:

Shiva Prasad Adirala

unread,
Apr 11, 2019, 7:07:45 AM4/11/19
to robotframework-users
1. Get date from application (assume its a text in application)

${current_application_date}=    Get Text   <locator>


2. Get Current Date (using datatime library)

${current_date}=    Get Current Date   result_format=%d.%m.%Y


3. Subtract both date's (assumes both the date formats are same)

${difference_date}=    Subtract Date From Date    ${current_date}    ${current_application_date}

Should Be True  ${difference_date}<30

peshwanth vummity

unread,
Apr 12, 2019, 2:21:37 AM4/12/19
to adiral...@gmail.com, robotframework-users
Hi,

Thanks for suggestions. I have installed DateTime library i have import that library in my script too. But I am not getting keywords like 'Get current date',"subtract date from date".  

I have installed DateTime 4.3. If i need to install some other library pls provide link for that. I am trying to download DateTime 3.1.1 but I am not getting zip file.


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

peshwanth vummity

unread,
Apr 12, 2019, 2:26:34 AM4/12/19
to adiral...@gmail.com, robotframework-users
I am using Robot Framework 2.7.7 (Python 2.7 on win32)

Tatu Aalto

unread,
Apr 12, 2019, 3:38:25 AM4/12/19
to vpes...@gmail.com, adiral...@gmail.com, robotframework-users
Ugh

DateTime is a Robot Framework standard library starting from 2.8.x release. Therefore it's not available in your installation, easiest way to get it, is to update your installation.

-Tatu
Send from my mobile

Pekka Klärck

unread,
Apr 12, 2019, 3:56:34 AM4/12/19
to vpes...@gmail.com, Shiva Prasad Adirala, robotframework-users
peshwanth vummity (vpes...@gmail.com) wrote:
>
> I am using Robot Framework 2.7.7 (Python 2.7 on win32)

Wow, that's an ancient version. I hope your project has plans to
upgrade soon. Unfortunately there have been several backwards
incompatible changes after 2.7.7 and upgrading directly to the latest
version may not be easy. I'd recommend you to upgrade first to 2.8.x
('x' referring to the latest version in that series), then to 2.9.x,
than to 3.0.x and finally to 3.1.x. Biggest changes are probably those
related to variables in RF 2.9. Anyway, the only way to learn about
the problems is trying out and reading release notes in detail. Good
luck!

The DateTime module you have installed is most likely this:
https://pypi.org/project/DateTime/. It's a legacy module related to
Zope and isn't related to Robot Framework at all. As Tatu already
commented, Robot's own DateTime library is included in RF 2.8 and
newer. You could try extracting it from newer version and using with
RF 2.7.7 but I got a feeling that it uses internal APIs not available
in that version. Probably easier to upgrade.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
Reply all
Reply to author
Forward
0 new messages