Question: I have this code.c in ubuntu in terminal 
but when I compile it with gcc this error appeared

```
cod2.c: In function ‘main’:
cod2.c:9:11: error: subscripted value is neither array nor pointer nor vector

```

why is that?

```
int  main(int argc , char ** argv){
    mkdir(argc[1] , 00755);
    return 0;
}

```

Answer: 
Date stored in varchar is not a real date and hence the order by also does not give you what you want. The best approach would be store date always in mysql native data types. However in your case you can use `str_to_date()` function to convert the varchar dates to real date and then use it for sort something as

```
order by str_to_date(date_created,'%Y-%m-%d %H:%i:%s');

```
You are using the wrong format in your `STR_TO_DATE` function, if the date is in the format:

```
2014-09-22 10:28:28

```

Then you need to use

```
STR_TO_DATE(date_created, '%Y-%m-%d %H:%i:%s')

```

i.e. the format you give should match the format your varchar is in.

**[Example on SQL Fiddle](http://sqlfiddle.com/#!2/df7ee/3)**

In your case you are using `'%b-%e-%Y'`, so you are looking for a date like `Jan-1-2014`, for a full list of the specifiers in the format defintion see the [My SQL Docs for DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format)

Also, `CONVERT(date_created, date, 103)` does not work because it is SQL Server Syntax.

Finally, I would really, really try and change the column data type. Storing dates as a varchar is never a good idea. Anything else is just a workaround, not a solution.