public class CurrencyDateTime extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.openqa.selenium.WebDriver |
driver
The driver.
|
| Constructor and Description |
|---|
CurrencyDateTime(org.openqa.selenium.WebDriver driver)
Instantiates a new currency and dates.
|
| Modifier and Type | Method and Description |
|---|---|
static Date |
addHoursToCurrentDate(int hoursToAdd)
Add hours to current date and time.
|
static String |
getCurrentDate(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder)
Returns Current Date from local system in custom format and order.
|
static String |
getCurrentDateFromNetwork(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder)
Returns Current Date from global internet server in custom format and order.
|
static Date |
getCurrentDateFromNetwork2()
Gets the current date from global internet server.
|
static Date |
getCurrentDateTimeFromNetwork()
Gets the current date and time from global internet server.
|
static String |
getCurrentDateTimeStamp()
Returns Current Date and Time from local system in format(yyyyMMdd_HHmmss)
|
static String |
getDateFromPastDays(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder,
int days)
Returns date of Past(specify difference in Days) from today in custom format and order.
|
static String |
getDateFromPastYears(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder,
int years)
Returns date from Past(specify difference in Years) from today in custom format and order.
|
static String |
getDateOfFutureDays(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder,
int days)
Returns date of Future(specify difference in Days) from today in custom format and order.
|
static String |
getDateOfFutureYears(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder,
int years)
Returns date of Future(specify difference in Years) from today in custom format and order.
|
static String |
getNextWeekSameDay(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder)
Returns nextWeekSameDay in custom format and order.
|
static String |
getTomorrowsDate(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder)
Returns tomorrow's Date in custom format and order.
|
static String |
getYesterdaysDate(String dateFormat,
String monthFormat,
String yearFormat,
String divider,
String dateMonthYearOrder)
Returns yesterday's Date in custom format and order.
|
static boolean |
isDateValid(int year,
int month,
int day)
Checks if the date passed is valid or not.
|
static boolean |
isDateValid(String date)
Checks if the date passed is valid or not.
|
static long |
subtractDateFromDateReturnDays(String date1,
String date2,
String dateMonthYearOrder)
Subtract date from date.
|
public CurrencyDateTime(org.openqa.selenium.WebDriver driver)
driver - the driverpublic static boolean isDateValid(String date) throws Exception
date. - Format should be "dd-MM-yyyy". Ex: 28-02-2016Exceptionpublic static boolean isDateValid(int year,
int month,
int day)
throws Exception
year. - Ex: 2016month. - Ex: 02day. - Ex: 28Exceptionpublic static Date getCurrentDateTimeFromNetwork() throws Exception
Exception - the exceptionpublic static String getCurrentDateFromNetwork(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"Exceptionpublic static Date getCurrentDateFromNetwork2() throws Exception
Exception - the exceptionpublic static String getCurrentDate(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"Exceptionpublic static String getCurrentDateTimeStamp() throws Exception
Exception - the exceptionpublic static String getTomorrowsDate(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"Exceptionpublic static String getYesterdaysDate(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"Exceptionpublic static String getNextWeekSameDay(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"Exceptionpublic static String getDateFromPastDays(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder, int days) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"days - the days as int. Ex: 2Exceptionpublic static String getDateOfFutureDays(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder, int days) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"days - the days as int. Ex: 2Exceptionpublic static String getDateFromPastYears(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder, int years) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"years - the years as int. Ex: 2Exceptionpublic static String getDateOfFutureYears(String dateFormat, String monthFormat, String yearFormat, String divider, String dateMonthYearOrder, int years) throws Exception
dateFormat - the date format. Ex: "dd"monthFormat - the month format. Ex: "MM" or "MMM" or "MMMM"yearFormat - the year format. Ex: "yyyy"divider - the divider. Ex: " " or "-" or "/"dateMonthYearOrder - the date month year order. Ex: "dmy" or "ymd" or "myd", Also by default the order is "ymd"years - the years as int. Ex: 2Exceptionpublic static long subtractDateFromDateReturnDays(String date1, String date2, String dateMonthYearOrder) throws Exception
date1 - the date1 in format "yyyy MM dd". Ex: 2015 10 14date2 - the date2 in format "yyyy MM dd". Ex: 2015 10 20dateMonthYearOrder - the date month year order for input/result date. Ex: "ymd" or "mdy" or "dmy", Also by default the order is "ymd"Exception