Date Time

Date Time action keywords help us to make changes to the date-time and use the according to our convenience.

Suppose the default date format set in application configuration is MM/dd/yy & you wish to use the current date in the format dd,MM,yyyy.

Structure :

setDateFormat <parameter>

copyCurrentDate <parameters>

If setDateFormat keyword was not used, the current date would be stored in the default format (mentioned under Application Configuration).

Now since we have used serDateFormat keyword, the current date will be stored in the newly set format.

 

Action

Parameters

Example Usage

Action

Parameters

Example Usage

addDaysToDateAndStore

Web, Mobile


To add number of days to current date and store resultant for future use.

Param 1 : Number of days to be added to the date
Param 2 : Variable name to store the new date
Param 3 (optional) : Date to add the days to

Enter the date in the format mentioned in Date Format set under Application configuration (default / user defined).

Example:

addDaysToDateAndStore : <Number of Days : 5> <In Variable : bqVariable> <Date : >

Adds 5 days to current date (if date not mentioned in param 3) and stores into bqVariable

addDaysToDateAndStore : <Number of Days : 5> <In Variable : bqVariable> <Date : 04/01/20>

Adds 5 days to mentioned date 04/01/20 and stores into bqVariable

addMonthToDateAndStore

Web, Mobile


To add number of months to current date and store resultant for future use.

Param 1 : Number of months to be added to the date
Param 2 : Variable name to store the new date
Param 3 (optional) : Date to add the months to

Example:

addMonthToDateAndStore : <Number of Months: 5> <In Variable : bqVariable> <Date : 04/01/20>

Adds 5 months to current date (if date not mentioned in param 3) and stores into bqVariable

addMonthToDateAndStore : <Number of Months : 5> <In Variable : bqVariable> <Date : 04/01/20>

Adds 5 months to mentioned date 04/01/20 and stores into bqVariable

addYearToDateAndStore

Web, Mobile


To add number of years to current date and store resultant for future use.

Param 1 : Number of years to be added to the date
Param 2 : Variable name to store the new date
Param 3 (optional) : Date to add the years to

Example:

addYearToDateAndStore : <Number of Years : 1> <In Variable : bqVariable> <Date : 04/01/20>

Adds 1 year to current date (if date not mentioned in param 3) and stores into bqVariable

addYearToDateAndStore : <Number of Years : 1> <In Variable : bqVariable> <Date : 04/01/20>

Adds 1 year to mentioned date 04/01/20 and stores into bqVariable

addPartToDateTimeAndStore

Web, Mobile


To store the value into variable (mentioned in Paramater 3) after adding value (mentioned in parameter 2) and into date (mentioned in parameter 4).

Param 1 : Part of the Date
Param 2 : Number to add to the mentioned part of the date
Param 3 : Variable name to store the new value
Param 4 (Optional) : Date-time
Param 5 (Optional) : Valid date-time format to store the value in that format

If Param 4 is not mentioned, the current date-time will be used.

If Param 5 is not provided, the default format will be used (displayed under Application configuration).

Example:

addPartToDateTimeAndStore : <Date Part : day> <Number to add : 20> <In Variable : bqVariable> <DatTime : > <Valid date-time format : >

Stores into variable bqVariable after adding 20 days to current date-time (if Param 4, is not provided) as mentioned in the default date-time format (if not provided).

For Param 1 (Date Part), you can use any of these : day, month, year, hour, minute, second.

copyCurrentDateTo

Web, Mobile


To store the current date (default format will be used, the one mentioned in application configuration settings) to a variable for future use.

Param 1 : Variable name to store the date

Example:

copyCurrentDateTo : <In Variable : bqVariable>

Stores the current date to variable bqVariable

copyCurrentDateTimeTo

Web, Mobile


To store the current date and time (default format will be used, the one mentioned in application configuration settings) to a variable for future use. 

Param 1 : Variable name to store the date-time

Example:

copyCurrentDateTimeTo : <In Variable : bqVariable>

Stores the current date with timestamp to variable bqVariable

copyElementValueAsDateTime

Web, Mobile


To store the object (mentioned in objectName) value to a variable (mentioned in Parameter 1) as date-time, in format (mentioned in Parameter 2) for future use.

Param 1 : Variable name to store the element value as date-time
Param 2 (Optional) : Valid format for date-time
Param 3 (Optional) : Left Boundary
Param 4 (Optional) : Right Boundary

Example:

copyElementValueAsDateTime : <Object : bqObject > <In Variable : bqVariable> <Valid date-time format : MM-dd-yyyy HH:mm:SS> <Left Boundary : > <Right Boundary : >

Stores the object’s bqObject value to variable bqVariable as date-time in the mentioned format MM-dd-yyyy HH:mm:SS.

copyElementValueAsDate

Web, Mobile


To store object (mentioned in objectName) value to a variable (mentioned in Parameter 1) as date, in format (mentioned in Parameter 2) for future use.

Param 1 : Variable name to store the element value as date
Param 2 (Optional) : Valid format for date
Param 3 (Optional) : Left Boundary
Param 4 (Optional) : Right Boundary

copyElementValueAsDate : <Object : bqObject > <In Variable : bqVariable> <Valid date-time format : MM-dd-yyyy> <Left Boundary : > <Right Boundary : >

Stores the object’s bqObject value to variable bqVariable as date in the mentioned format MM-dd-yyyy.

copyDateValueTo

Web, Mobile


To store static value to a variable as Date for future use. 

Param 1 : Date to copy
Param 2 : Variable name to store the date value
Param 3 (Optional) : Valid date format
Param 4 (Optional) : Left Boundary
Param 5 (Optional) : Right Boundary

Example:

copyDateValueTo : <Date : 09/01/2012> <In Variable : bqVariable > <Date Format : MM/dd/yyyy> <Left Boundary : Bqurious is> <Right Boundary : , California.>

To store 09/01/2012 in MM/dd/yyyy format from string “Founding date of Bqurious is 09/01/2012, California.” , using left boundary “Bqurious is” and right boundary , California in variable bqVariable as Date.

restoreDefaultDateFormat

Web, Mobile


To restore default date format defined in application configuration settings.

 

Example:

restoreDefaultDateFormat

Restores the default date format mentioned in configuration settings.

If you wish to use a certain date format only for a particular field and default format for the rest of the test case. Use the keyword setDateFormat for that field & then use restoreDefaultDateFormat later in the test case.

restoreDefaultDateTimeFormat

Web, Mobile


To restore default date-time format defined in application configuration settings.

 

Example:

restoreDefaultDateTimeFormat

Restores the default date-time format mentioned in configuration settings.

If you wish to use a certain date-time format only for a particular field and default format for the rest of the test case. Use the keyword setDateTimeFormat for that field & then use restoreDefaultDateTimeFormat later in the test case.

setDateFormat

Web, Mobile


To change the current date format of the application.

Param 1 : Valid date format

Example:

setDateFormat : <Valid date format : dd,MM,yyyy>

Sets the date format to dd,MM,yyyy

Suppose you wishe to use the current date in the date format dd,MM,yyyy. All you need to do is, use the keyword setDateformat to set the date format to dd,MM,yyyy & then use keyword copycurrentDateTo to store the current date in a variable of your choice. The current date will be stored in the mentioned date format dd,MM,yyyy. Use the date stored in variable with appropriate keyword.

setDateTimeFormat

Web, Mobile


To change the current date-time format of the application.

Param 1 : Valid date-time format

Example:

setDateTimeFormat : <Valid date-time format : dd/MM/yyyy::HH:mm:SS>

Sets the date-time format to dd/MM/yyyy::HH:mm:SS

Suppose you wishe to use the current date-time in the date-time format dd/MM/yyyy::HH:mm:SS. All you need to do is, use the keyword setDateTimeformat to set the date-time format to dd/MM/yyyy::HH:mm:SS & then use keyword copycurrentDateTimeTo to store the current date-time in a variable of your choice. The current date-time will be stored in the mentioned date-time format dd/MM/yyyy::HH:mm:SS. Use the date-time stored in variable with appropriate keyword.

verifyDate

Web, Mobile


To verify the value (mentioned in Parameter 1) is a valid date as per the format (mentioned in parameter 2).

Param 1 : Date value
Param 2 : Format of the date

Example:

verifyDate : <Object : bqObject> <Value : 02//03/20> <Format : MM/dd/yy>

Verifies value of bqObject is valid date as per format MM/dd/yy

verifyDateTime

Web, Mobile


To verify the value (mentioned in Parameter 1) is valid date-time as per format (mentioned in parameter 2).

Param 1 : Date-time value
Param 2 : Format of the date-time

Example:

verifyDateTime : <Object : bqObject> <Value : 02//03/20> <Format : MM/dd/yyyy HH:mm:SS>

Verifies value of bqObject is valid date-time as per format MM/dd/yyyy HH:mm:SS