1
Mazar
Having problem with xoops formdatetime
  • 2009/8/27 7:59

  • Mazar

  • Not too shy to talk

  • Posts: 191

  • Since: 2009/1/4 0


I am trying to insert date time as unix timestamp in database
i have my fields as INT in database

but how can insert them. the date time is going into two dimensional array
which has been giving me headache from past two days.

can anyone point out how can insert them to database

2
Mazar
Re: Having problem with xoops formdatetime
  • 2009/8/27 8:07

  • Mazar

  • Not too shy to talk

  • Posts: 191

  • Since: 2009/1/4 0


this is how it showing on source when i am vewing source of hte html




3
Mamba
Re: Having problem with xoops formdatetime
  • 2009/8/27 8:08

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Why are you inserting them as a two-dimensional array?

You should be able to store the date/time as Unix timestamp in one field, and then extract the date or the time portion of it, as needed.

Unless I am totally wrong here....

4
Mazar
Re: Having problem with xoops formdatetime
  • 2009/8/27 8:14

  • Mazar

  • Not too shy to talk

  • Posts: 191

  • Since: 2009/1/4 0


You mean i should add it one field? i tried that but it is not working i dont know maybe i am doing something wrong

$obj->setVar("bookings_date"strtotime($_REQUEST["bookings_date[date]"]));
$obj->setVar("bookings_time"$_REQUEST["bookings_date[time]"]);

I am trying this way as in above htmml the date time namings and inputs are as follows
I know it should be separated using a foreach or somehting but i am not understanding how can use foreach for date and time coz it is going as array inside the post array

5
bumciach
Re: Having problem with xoops formdatetime
  • 2009/8/27 8:52

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


It should be in one field... Did you try something like that?
$datetime strtotime($_REQUEST["bookings_date[date]"]) + $_REQUEST["bookings_date[time]"];
$obj->setVar("bookings_datetime"$datetime);

6
Mazar
Re: Having problem with xoops formdatetime
  • 2009/8/27 9:03

  • Mazar

  • Not too shy to talk

  • Posts: 191

  • Since: 2009/1/4 0


That is getting only 0 it is not getting the value of input fields

7
Mazar
Re: Having problem with xoops formdatetime
  • 2009/8/27 9:36

  • Mazar

  • Not too shy to talk

  • Posts: 191

  • Since: 2009/1/4 0


You are right i managed to add date time now when i am using formatTimeStamp
it is giving me gmt time i need gmt+2

how can i add gmt+2 and formatTime stamp?

8
bumciach
Re: Having problem with xoops formdatetime
  • 2009/8/27 9:45

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


$bookings_date=$_REQUEST["bookings_date"];
$datetime strtotime($bookings_date['date']) + $bookings_date['time'];
$obj->setVar("bookings_datetime"$datetime);

Login

Who's Online

319 user(s) are online (245 user(s) are browsing Support Forums)


Members: 0


Guests: 319


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits