Convert date format

how to convert date in format MMM dd yyy to dd MMM yyy.

Please use this.

Also see here

P.S. Ignore the :warning: sign beside the block.

Cheers ,
Kunj

You could do it with a JOIN of three Segment() calls against your text input:
JOIN(
segment(input,5,3),
segment(input,1,4),
segment(input,8,4)

I assume you meant yyyy instead of yyy for a year,
and that the segment block accepts input, start, length.

Hello, I have tried what you suggest and it converts the date to text. Thanks a lot.
Maybe I did not explain it well, my problem is that I am entering a date and then I want to subtract it from the current date to know how many days are left to reach the defined date. For example, to know how many days until the expiration date of a product from its expiration date on the label.

The operation GetMillis cannot accept the arguments: , ["24/11/2020"]
How do I solve this so that I can subtract an entered date from the current system date.

Read the tooltip for GetMillis.

It can only accept an Instant, which is not a piece of text.

See this Gallery app
http://ai2.appinventor.mit.edu/?galleryId=6069685827928064

Thank you. Well, what I am doing is saving a date (for example 12/25/2020 with format dd/MM/aaa) and and after saving it I visualize it at a later date and when executing a button for the calculation it should show me the date difference (in days) of the saved date (12/25/2020 for example) and the current date which is currently 11/24/2020.

3 Likes

Thanks again. I have tried everything that has been suggested and it does not work. How would you do to save the expiration date of a product and that when executing a query it tells us how many days until that product expires. In this message I think I have expressed myself better.

No, I don't understand your problem. Show your blocks and explain in detail what should happen (example):

  1. save expiration date (e.g. 25 12 2020)
  2. save the current date
  3. click on button ...
  4. ...

Hi. First I save the expiration date. Then to know when a product expires, press from a button and when doing that, the current system date must be subtracted from the expiration date in order to know how many days until a product expires. I can't find how to do that, because when recovering the saved date, I can't subtract it from the current system date.

I think DurationToDays and Duration blocks in the Clock section should solve your problem:

is this what you're looking for?

Try this

expiryDate.aia (3.3 KB)

image

1 Like

Excellent, it works for me for what I want to do. Thank you so much.