Yii Framework Forum: Problem With Date In Textfield - Yii Framework Forum

Jump to content

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

Problem With Date In Textfield Rate Topic: -----

#1 User is offline   nkdos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 47
  • Joined: 18-June 13

Posted 30 June 2013 - 06:06 PM

I want to store the current time as the default value of a textfield.

The code I have is:

<div class="row">
<? php $ model-> time = date ('H: i: s');?>
<? php echo $ form-> labelEx ($ model, 'time');?>
<? php echo $ form-> textField ($ model, 'time', array ('value' => date ('H: i: s'), 'readonly' => true));?>
<? php echo $ form-> Error ($ model, 'time');?>
</ div>


The problem is that it saves me time, however, I keep a date, for example:

2019-00-14

what's a problem?
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,062
  • Joined: 16-February 11
  • Location:Japan

Posted 30 June 2013 - 08:00 PM

Hi nkdos,

Sorry, but I couldn't understand what your issue is. Would you please show us the relevant code in the model and the controller?

BTW, is the strange spacing in the code intentional?
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