linssendesign Posted June 7, 2008 Share Posted June 7, 2008 i have 5 variables from a form: $dagpost = $_POST['dagen']; $maandpost = $_POST['maanden']; $jaarpost = $_POST['jaren']; $uurpost = $_POST['uren']; $minuutpost = $_POST['minuten']; i have the following in my database: dag char(2) latin1_swedish_ci Nee maand int(2) Nee 0 jaar varchar(4) latin1_swedish_ci Nee datum datetime No 0000-00-00 00:00:00 tijd time No 00:00:00 how do i get these 5 numbers into the datetime format so my database can accept this variables... ? many thanks! Link to comment https://forums.phpfreaks.com/topic/109140-datetime/ Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 Just use the MySQL NOW() function. =) Link to comment https://forums.phpfreaks.com/topic/109140-datetime/#findComment-559841 Share on other sites More sharing options...
linssendesign Posted June 7, 2008 Author Share Posted June 7, 2008 its for a list of agenda items when an event is happend example: there is a presentation on: 01-08-2009 at 04:30 these are the variables: $dagpost = $_POST['01']; $maandpost = $_POST['08']; $jaarpost = $_POST['2009']; $uurpost = $_POST['04']; $minuutpost = $_POST['30']; how do i convert this to a datetime format ? Link to comment https://forums.phpfreaks.com/topic/109140-datetime/#findComment-559845 Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 Oh. D: $time = $dagpost . "-" . $maandpost . "-" . $jaarpost . " " . $urrpost . ":" . $minuutpost . ":00"; Link to comment https://forums.phpfreaks.com/topic/109140-datetime/#findComment-559847 Share on other sites More sharing options...
linssendesign Posted June 7, 2008 Author Share Posted June 7, 2008 Thats what i need, it works! many thanks. Link to comment https://forums.phpfreaks.com/topic/109140-datetime/#findComment-559851 Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 No problem. Link to comment https://forums.phpfreaks.com/topic/109140-datetime/#findComment-559854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.