javascript - How to add Time Timestamp to DateTime Timestamp? -
i having project have time duration service have converted strtotime , also, have datetime picker have converted strtotime, in data base, so, using calendar https://github.com/almasaeed2010/adminlte,
now, here problem, in calendar sample there code
{ title: 'long event', start: new date(y, m, d - 5), end: new date(y, m, d - 2), backgroundcolor: "#f39c12", //yellow bordercolor: "#f39c12" //yellow },
what trying accomplish service duration,let's duration 2 hours converted strtotime, how can add timestamp of datetime? these code , screenshot below, can see, result wrong since appoint_end 2 hours appointment displayed days,
events: [ <?php $event_query = mysql_query("select * appointment,service,user appointment.user_id = user.user_id , service.service_id = appointment.service_id")or die(mysql_error()); while($event_row = mysql_fetch_array($event_query)){ $e = $event_row['appoint_date']; $ee = $event_row['appoint_end']; $eee = $e + $ee; ?> { title : '<?php echo $event_row['firstname'].' '.$event_row['lastname']; ?> ', start : '<?php echo $event_row['appoint_date']; ?>', end: '<?php echo $eee; ?>', allday: false, backgroundcolor: "#3c8dbc", //primary (light-blue) bordercolor: "#3c8dbc" //primary (light-blue) }, <?php } ?> ],
the start date ok, end, since added 2 hours service timestamp datetime timestamp, do?
php time function:
time();
<?php $nextweek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60 secs echo 'now: '. date('y-m-d') ."\n"; echo 'next week: '. date('y-m-d', $nextweek) ."\n"; // or using strtotime(): echo 'next week: '. date('y-m-d', strtotime('+1 week')) ."\n"; ?>
this snippet of code returns:
now: 2005-03-30
next week: 2005-04-06
next week: 2005-04-06
refer php time() manual more information
Comments
Post a Comment