S
S
Sasha Tsikhun2021-09-28 19:00:34
PHP
Sasha Tsikhun, 2021-09-28 19:00:34

Is it possible to sort a string containing a date?

There is a json file where the date is written. But I do it very primitively - I just write it into a string (example: [[{"date":"5 January 2005"}],[{"date":"5 March 2005"}]). 61533bdcb789d038810436.jpeg
Can I sort the date somehow?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
R
Rsa97, 2021-09-28
@realalex

You can. Convert dates to standard YYYY-MM-DD format and sort as regular strings.

S
Sasha Tsikhun, 2021-09-28
@realalex

yeah, I found the strtotime() function, which should help me, thanks)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question