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
Asked
Active
Viewed 1.1e+01k times
8
-
1date("Y-m-d"). why you need codeigniter? – Suresh Kamrushi Apr 05 '13 at 09:30
-
Hi suresh, i am new to on php.. i have no idea about to develop a php websites – Apr 05 '13 at 09:35
6 Answers
15
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

Community
- 1
- 1

Edwin Alex
- 5,118
- 4
- 28
- 50
-
all the answers posted here are giving you exactly the thing you want. What else do you need – Muhammad Raheel Apr 05 '13 at 09:34
6
Try to use this is a generic format of DateTime
echo date('Y-m-d H:i:s');

Soner Gönül
- 97,193
- 102
- 206
- 364

archisss
- 61
- 1
- 1
1
if you want the full date:
echo date('Y-m-d');
depends your date structure.
echo date('d-m-Y');
if you want year only, then echo date('Y');
is enough

Aslam Kakkove
- 97
- 1
- 12
0
Use php date() function, like this echo Date('Y/m/d'); it give you the desired result!