0

Greetings to you all!

Please I need suggestion on how to format my Php form to show last login date on form as dd/mm/yyyy or 12-February-2014. I want my form to print to the user saying: Hello and Welcome ! Your last login is dd/mm/yyyy or 12-February-2014. The last login here is the very login session he/she is in.

I am using MySQL as backend database but like you know MySQL captures date as yyyy/mm/dd but I dont want it shown that way when the user logins in.

How can I handle this please?

Thank you in advance.

Mike

Prince Michael
  • 85
  • 3
  • 3
  • 10

2 Answers2

0

See http://in3.php.net/manual/en/function.date.php

Use like

   echo date("d/F/Y",$datevar);

or

   echo date("d-F-Y",$datevar);
DhruvJoshi
  • 17,041
  • 6
  • 41
  • 60
0

Use MySql DATE_FORMAT FUNCTION >> DATE_FORMAT(your_date,'%d %b %y')

for example,

DATE_FORMAT(now(),'%d %b %y') gives you 21 Feb 14

OR

DATE_FORMAT(NOW(),'%m-%d-%Y') gives you 21-2-2014

Mario Radomanana
  • 1,698
  • 1
  • 21
  • 31
DexJ
  • 1,264
  • 13
  • 24