I need some help with what I am sure is a simple solution toa problem that I am spending to much time trying to resolve. Let me setup theproblem and please remember that I am very new to YII and PHP.
I followed the Blog Tutorial and setup my MySQL database asrequired and all works well. I can add, update and deleted without problems.
Now I wanted the user to be able to change the date for create_time,so I added the jquery datetime picker. This is where I have the problem. Thecreate_time field is an INT (11), which is setup for a Unix Timestamp. Thedatetimepicker has an option for Unix timestamps, dateFormat => ‘@’, butthis is adding millisecond’s to the date.
So for October 23, 2023 the timestamp is 1382547600, whichthe date picker can’t read and if I select that date from the date picker itputs 1382547600000 in the field, but it will not save it. The SQL error that Iam getting is the field is to small so I increased the field to 15 and triedagain with no luck the same SQL error.
Researching the problem tells me that I need to divide thestamp by 1000. When I select the date and remove 3 zeros the date shows upcorrectly, but again the date picker will not pick it up correctly.
I am not sure where I should be dividing and multiplying toget the correct dates, I am guessing it will be in the post controller.
My goal id to use the altFormat => ‘@’ and thendateFormat to display the format I want to see.
I hope someone can give me some insight or guidance to helpme resolve this issue. Thank you in advance for your time.