Search code examples
phpjavascriptcodeignitercodeigniter-2

How to get current date in codeigniter


How to get current date in codeigniter in YY-mm-dd format. I wants to get current date in YY-mm-dd frmat and put this value into input text box


Solution

  • You can use the PHP date function.

    date('Y-m-d');
    

    Up to my knowledge, there is no separate date function in codeigniter.

    EDIT :

    But if you want date in this format 13-04-05 [ yy-mm-dd ], Try this

    date('y-m-d');
    

    For more date formats, check this link PHP Date Formats