Log in or register to post comments

VWS code snippet question

February 12, 2014 - 4:05pm #1

Dear Vuforia Engineers,

In the Java sample code I found the following code snippet, which confused me.

DateUtils.formatDate(new Date()).replaceFirst("[+]00:00$", "")

Why cannot I just use DateUtils.formatDate(new Date())?

What is the use of replaceFirst("[+]00:00$", "")?

Thank you for your time.

Best Regards,

Peng

VWS code snippet question

February 12, 2014 - 8:51pm #2

That's simply to prepare the new Date() string so that it is formatted correctly for the expected date format - it is removing the leading 00:00 in the stamp . If you have to use another approach, you'll need to ensure that it results in the same exact date format. The date string is used for authentication and the specification only recognize one specific date format. Take a look at the role that the Date field plays in authenticating the request to see why.

If you can't replicate the necessary format, please post the Date that your code produces and we can help you reformat it to meet the specfication.

Log in or register to post comments