The following Parameters must be Valid date and format (yyyy-MM-dd’T'HH:mm:ssz): date_of_expiration

Asked

Viewed 97 times

1

Hello.

I am creating a payment system via pagseguro, where this system is not letting create billets, because it claims the date.

I know the date in style 2020-05-30T21:52:49.000-04:00works, but date('Y-m-dH:i:s.uZ', strtotime($data. '+ 3 days'));

How to generate date in this model that I said works?

1 answer

0


From what I’ve seen, you’re missing the’T' in your code. Also, by documentation of pagseguro they use the fraction of seconds with 3 houses, for that you must use 'v' in the format and for the time zone, one must use 'P'. Ref

That way, I believe it should work:

date('Y-m-d\TH:i:s.vP', strtotime($data. '+ 3 days'));

Remembering that \T places T as extra character and Z, for documentation of pagseguro, is optional.

Take care with the use do date('c', ...) for even this converting to the ISO 8601 ( same as pagseguro says accept ), milisegundos has more than 4 decimal places.

  • That way you keep making the same mistake

  • Try it this way then: date('c', strtotime($data. '+ 3 days'));. Thus, the date would be in the ISO 8601 standard, the same one that the pagseguro uses. If it works, let me know so I can edit the answer in a more complete way.

  • worked not: 2020-05-29T21:29:06-03:00 mine was generated and 2020-05-30T21:52:49,000-04:00 and the one that works, missing milliseconds seems

  • Actually, from what I’m reading about, this PHP format is not exactly the same as iso. Try Y-m-d\TH:i:s.uP

  • tb n kkkkkkk, I’m not sure how the mercadopago wants me to send this date

  • tries Y-m-d TH:i:s. Vp whereas the documentation I Linkei is wrong/outdated and it is mandatory to time zone. Thus, the output is exactly equal to 2020-05-30T21:52:49,000-04:00

  • good, worked, abigo

  • gloria, later I edit the original reply with more details

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.