If you were logged in you would be able to see more operations.
|
|
|
QuickBuild
Created: 31/May/21 10:22 AM
Updated: 01/Jun/21 03:07 PM
|
|
Component/s: |
None
|
Affects Version/s: |
10.0.21
|
Fix Version/s: |
11.0.3
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
I've used variable my_date with Prompt as Date Input setting, provided todays date (2021-05-31). Then I've tried to get that date in different format, using vars.get().asDate() and uitl.formatDate(), which gave me previous day instead of current. Minimal working example code below. It's clearly connected with user/instance timezone but I'd like to avoid hardcoding "add 1 day" wherever we use date variables.
groovy:
my_date = vars.get("my_date")
logger.info("To string: " + my_date.toString())
// To string: 2021-05-31 +0200
logger.info("Date with underscores: " + util.formatDate(my_date.asDate(), "yyyy_MM_dd"))
// Date with underscores: 2021_05_30
logger.info("Full datetime object: " + util.formatDate(my_date.asDate(), "yyyy-MM-dd, HH:mm:SS Z"))
// Full datetime object: 2021-05-30, 22:00:00 +0000
|
Description
|
I've used variable my_date with Prompt as Date Input setting, provided todays date (2021-05-31). Then I've tried to get that date in different format, using vars.get().asDate() and uitl.formatDate(), which gave me previous day instead of current. Minimal working example code below. It's clearly connected with user/instance timezone but I'd like to avoid hardcoding "add 1 day" wherever we use date variables.
groovy:
my_date = vars.get("my_date")
logger.info("To string: " + my_date.toString())
// To string: 2021-05-31 +0200
logger.info("Date with underscores: " + util.formatDate(my_date.asDate(), "yyyy_MM_dd"))
// Date with underscores: 2021_05_30
logger.info("Full datetime object: " + util.formatDate(my_date.asDate(), "yyyy-MM-dd, HH:mm:SS Z"))
// Full datetime object: 2021-05-30, 22:00:00 +0000 |
Show » |
|
https://build.pmease.com/build/5314