Yii Framework Forum: Auto-Calculate The Date - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Auto-Calculate The Date auto-calculate the date

#1 User is offline   ahmad albab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 07-January 14

Posted 25 January 2014 - 10:44 PM

Hi...:)

i'm having a problem to auto-calculate the date...
i mean,how to calculate the day between date?

for example; Jan 26th until Jan 30th = 5 days...

can anyone help me? thank you...:D
sorry for my broken english...
0

#2 User is offline   ahmad albab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 07-January 14

Posted 09 February 2014 - 03:28 AM

hi guys
does anyone know how to solve my problem??
anyone??
please...
i really need your help...
thank you...
0

#3 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 09 February 2014 - 07:51 AM

You can do it in PHP using DateTime.
Don't be a dick.
0

#4 User is offline   ahmad albab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 07-January 14

Posted 18 February 2014 - 09:30 PM

View Postnineinchnick, on 09 February 2014 - 07:51 AM, said:

You can do it in PHP using DateTime.


hi..
i already try it..but it doesn't work..
i want it auto calculate the days..

any other suggestions?
or Yii doesn't have the way to auto calculate maybe?
0

#5 User is offline   ahmad albab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 07-January 14

Posted 22 February 2014 - 11:49 PM

hi guys...
i already try this method, but it still doesn't calculate it... :-[


<?php
      $date_start = new DateTime('');
      $date_end= new DateTime('');                   
      echo $duration = $date_start->diff($date_end)->days;      
?>


i refered from this

Quote

and

Quote



i hope anyone can help me to solve this...
thank you... :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users