本文整理汇总了PHP中mysql_to_unix函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_to_unix函数的具体用法?PHP mysql_to_unix怎么用?PHP mysql_to_unix使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_to_unix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_data
public function update_data()
{
$this->load->model('tags_model', 'tags', true);
$this->load->model('links_model', 'links', true);
$this->load->model('images_model', 'images', true);
$this->load->helper('date');
$config = $this->config->item('upload');
$file = file('/srv/www/themoviepostersite.com/posters.csv');
$data = '';
$views = array();
foreach ($file as $key => $value) {
$csv = str_getcsv($value);
$data['id'] = $csv[0];
$data['title'] = $csv[1];
$data['filename'] = $csv[2];
$num_views = $csv[3];
$data['created_on'] = mysql_to_unix($csv[4]);
$views['created_on'] = $csv[5];
$data['group_id'] = $csv[6];
$data['thumbnail'] = $csv[7];
$data['path_to_file'] = $config['upload_path'] . $data['id'];
//legacy path
$tags = explode(", ", $csv[9]);
$this->images->create($data);
foreach ($tags as $k => $v) {
$tag['tag'] = $v;
$this->tags->create($tag);
$id = $this->tags->get_insert_id();
$tag_link['itemid'] = $id;
$tag_link['item'] = 'tag';
$tag_link['pinupid'] = $data['id'];
$this->links->create($tag_link);
}
}
}
示例2: _get_updateddate
public function _get_updateddate($Date)
{
if (empty($Date)) {
return null;
}
return mysql_to_unix($Date);
}
示例3: edit
public function edit()
{
$id = abs((int) $this->uri->segment(4));
if (!empty($id)) {
$this->form_validation->set_rules('Start_time', 'start', 'required');
$this->form_validation->set_rules('End_time', 'end', 'required');
//validasi date
$start = $this->input->post('Start_time');
$end = $this->input->post('End_time');
if ($this->form_validation->run() == FALSE || $this->validate_date($start) == FALSE || $this->validate_date($end) == FALSE || (mysql_to_unix($end) - mysql_to_unix($start)) / 86400 <= 0) {
$this->data['user'] = $this->access->get_user($id);
$this->data['title'] = 'Edit Akses Satker';
$this->data['template'] = 'manajemen_akses/edit';
// $this->session->set_flashdata('message_type', 'error');
// $this->session->set_flashdata('message1', 'Data salah input');
$this->load->view('backend/index', $this->data);
} else {
$this->access->update_date($start, $end, $id);
$this->session->set_flashdata('message_type', 'success');
$this->session->set_flashdata('message', 'Data berhasil diperbaharui');
redirect('backend/access_management/');
}
} else {
redirect('backend');
}
}
示例4: retorno
function retorno()
{
$data['title'] = "Relatórios - Controle de Estoque";
$data['headline'] = "Relatório";
$data['include'] = 'Relatorio_retorno';
$this->load->model('MRelatorio', '', TRUE);
$qry = $this->MRelatorio->getConsumoProduto($_POST);
$table = $this->table->generate($qry);
$tmpl = array('table_open' => '<table id="tabela" class="relatorio">');
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_heading('Produto', 'Quantidade', 'Data');
$table_row = array();
$data['qry'] = array();
foreach ($qry->result() as $produto) {
$table_row = NULL;
$table_row[] = $produto->nome_produto;
$table_row[] = $produto->quantidade_pedida;
$data_human = mysql_to_pt($produto->data_pedido);
$table_row[] = $data_human;
$this->table->add_row($table_row);
$data['qry'][] = array(mysql_to_unix($produto->data_pedido) * 1000, $produto->quantidade_pedida);
}
$table = $this->table->generate();
$data['data_table'] = $table;
$this->load->view('template', $data);
}
示例5: view_forum
function view_forum($forumID = 0)
{
$this->load->helper('date');
$forumID = intval($forumID);
$forum = $this->forum_model->getForum($forumID);
// Check if topic exists
if (!empty($forum)) {
$forum['topic_list'] = array();
// Get a list of posts which have no parents (topics) in this forum
foreach ($this->post_model->getTopicsInForum($forumID) as $topic) {
$topic['post_count'] = count($this->post_model->getPostsInTopic($topic['postID']));
$topic['last_post'] = $this->post_model->getLastPost('topic', $topic['postID']);
// Convert to unix and see how long ago it was posted
$timespan = timespan(mysql_to_unix($topic['last_post']['post_date']));
// If its set and doesnt contain the word days in the timespan
if (isset($forum['last_post']['post_date']) && !strpos($timespan, 'Day')) {
$topic['last_post']['post_date'] = $timespan;
} else {
$topic['last_post']['post_date'] = $topic['last_post']['post_date'];
}
$forum['topic_list'][] = $topic;
}
$this->data = array_merge($this->data, $forum);
$this->layout->title('Forums > ' . $this->data['forum_name']);
$this->layout->create('view_forum', $this->data);
} else {
show_error('The Forum doesn\'t exist!');
$this->layout->create('message', $this->data);
}
}
示例6: get_cliente_by_id
function get_cliente_by_id($id)
{
$this->load->helper('date');
$query = $this->db->get_where("clientes", array("idcliente" => $id));
if ($query->num_rows() > 0) {
$c = $query->row_array();
if ($c['fecnac'] == "" || is_null($c['fecnac'])) {
$c['fecnac'] = "No especificado";
} else {
$c['fecnac'] = mdate("%d-%m-%Y", mysql_to_unix($c['fecnac']));
}
$c['fecnac2'] = $c['fecnac'];
$c['sexo'] = $c['sexo'] == 0 ? "Masculino" : "Femenino";
$c['ocupacion'] = $c['ocupacion'] == "" || is_null($c['ocupacion']) ? "No especificado" : $c['ocupacion'];
$c['direccion'] = $c['direccion'] == "" || is_null($c['direccion']) ? "No especificado" : $c['direccion'];
$c['colonia'] = $c['colonia'] == "" || is_null($c['colonia']) ? "No especificada" : $c['colonia'];
$c['cp'] = $c['cp'] == "" || is_null($c['cp']) ? "No especificado" : $c['cp'];
$c['ciudad'] = $c['ciudad'] == "" || is_null($c['ciudad']) ? "No especificada" : $c['ciudad'];
$c['estado'] = $c['estado'] == "" || is_null($c['estado']) ? "No especificado" : $c['estado'];
$c['telefono1'] = $c['telefono1'] == "" || is_null($c['telefono1']) ? "No especificado" : $c['telefono1'];
$c['telefono2'] = $c['telefono2'] == "" || is_null($c['telefono2']) ? "" : $c['telefono2'];
$c['email'] = $c['email'] == "" || is_null($c['email']) ? "No especificado" : $c['email'];
$c['enfermedad'] = $c['enfermedad'] == "" || is_null($c['enfermedad']) ? "No especificado" : $c['enfermedad'];
$c['avisar'] = $c['avisar'] == "" || is_null($c['avisar']) ? "No especificado" : $c['avisar'];
$c['aviparen'] = $c['aviparen'] == "" || is_null($c['aviparen']) ? "No especificado" : $c['aviparen'];
$c['avidom'] = $c['avidom'] == "" || is_null($c['avidom']) ? "No especificado" : $c['avidom'];
$c['avitel'] = $c['avitel'] == "" || is_null($c['avitel']) ? "No especificado" : $c['avitel'];
$c['vence'] = $c['vence'] == "" || is_null($c['vence']) ? null : $c['vence'];
return $c;
}
return false;
}
示例7: comments
function comments($comments, $object_id, $object, $usernames, $format, $return = 'agilan/index')
{
$string = "";
$string .= "<ol class='comments'>";
if (isset($comments[$object_id]) && count($comments[$object_id]) > 0) {
foreach ($comments[$object_id] as $kk => $ll) {
$CID = $ll->user_id;
$CU = $usernames[$ll->user_id];
$stamp = mysql_to_unix($ll->created);
$string .= "<li><b>" . $CU . ":</b> <small>" . $ll->comment . "<br/>" . mdate($format, $stamp) . "</small></li>";
}
} else {
$string .= nbs();
}
$string .= "<li class='last'>";
$string .= form_open('comments/index');
$input = array('name' => 'comment', 'id' => 'comment', 'size' => 35);
$string .= form_input($input);
$string .= form_hidden('object', $object);
$string .= form_hidden('object_id', $object_id);
$string .= form_hidden('return_url', $return);
$string .= form_submit('add comment', 'comment');
$string .= form_close();
$string .= "</li>";
$string .= "</ol>";
echo $string;
}
示例8: index
function index()
{
$ga = new ga();
$this->ga->authen('royalrain2512@gmail.com', 'rain2512', 'ga:98468001');
if ($_GET) {
$now = Date2DB($_GET['date']);
} else {
$now = date("Y-m-d");
}
$lastmonth = date('Y-m-d', strtotime('-29 days', mysql_to_unix($now)));
//Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates
$data['summery'] = $this->ga->getSummery($lastmonth, $now);
//All time summery: visitors, page views
$data['allTimeSummery'] = $this->ga->getAllTimeSummery();
//Last 10 days visitors (for graph)
$data['visits'] = $this->ga->getVisits($lastmonth, $now, 30);
//Top 10 search engine keywords
$data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10);
//Top 10 visitor countries
$data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10);
//Top 10 page views
$data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10);
//Top 10 referrer websites
$data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10);
//Top 10 visitor browsers
$data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10);
//Top 10 visitor operating systems
$data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10);
$this->template->append_metadata(js_datepicker());
$this->template->build("index", $data);
}
示例9: retorno_compra
function retorno_compra()
{
$data['title'] = "Relatórios - Controle de Estoque";
$data['headline'] = "Relatório";
$data['include'] = 'relatorio_retorno';
$this->load->model('MRelatorio', '', TRUE);
$qry = $this->MRelatorio->getCompraProduto();
$table = $this->table->generate($qry);
$tmpl = array('table_open' => '<table id="tabela" class="relatorio">');
$this->table->set_template($tmpl);
$this->table->set_empty(" ");
$this->table->set_heading('Número Nota', 'Fornecedor', 'Data da Nota', 'Valor Total');
$table_row = array();
$data['qry'] = array();
foreach ($qry->result() as $nota) {
$table_row = NULL;
$table_row[] = $nota->numero_nota;
$this->load->model('MFornecedor', '', TRUE);
$fornecedor = $this->MFornecedor->getFornecedor($nota->id_fornecedor)->result();
$table_row[] = $fornecedor[0]->razao_social;
$table_row[] = mysql_to_pt($nota->data_nota);
$table_row[] = ' ';
$this->table->add_row($table_row);
$data['qry'][] = array(mysql_to_unix($nota->data_nota) * 1000, $fornecedor[0]->razao_social);
}
$table = $this->table->generate();
$data['data_table'] = $table;
$this->load->view('template3', $data);
}
示例10: set_vars
private function set_vars($row)
{
if (!is_array($row)) {
return trigger_error('$comic->set_vars($row) must be called with an array as the argument!');
}
global $scdb;
$this->title = $row['title'];
$this->image = $row['image'];
$this->info = $row['info'];
$this->cat = (int) $row['cat'];
$this->category = $this->cat_info($this->cat);
$this->transcript = $row['transcript'];
$this->time = $row['time'];
$this->stamp = (int) mysql_to_unix($this->time);
$this->views = (int) $row['views'] + 1;
$this->ID = (int) $row['ID'];
$this->PID = (int) $row['PID'];
$user_info = $this->user_info($row['author']);
$this->author = $user_info->nicename;
$this->author_full = $user_info->name;
// keep until i've changed all calls to $this->type to $this->category->nicename
$this->type = $this->category->nicename;
$this->first = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1");
$this->last = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' AND `time` <= '" . NOW . "' ORDER BY `ID` DESC LIMIT 1");
if ($this->ID !== $this->first) {
$this->prev = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` < '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` DESC LIMIT 1");
}
if ($this->ID !== $this->last) {
$this->next = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` > '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1");
}
}
示例11: inc_statistic
public function inc_statistic()
{
$ga = new ga();
$this->ga->authen('royalrain2512@gmail.com', 'rain2512', 'ga:98468001');
// $ga->authen('royalrain2512@gmail.com','rain2512','ga:98468001');
$now = date("Y-m-d");
$lastmonth = date("Y-m-d", strtotime('-1 month', mysql_to_unix($now)));
$data["today"] = $this->ga->getSummery($now, $now);
$data["month"] = $this->ga->getSummery($lastmonth, $now);
$data["alltime"] = $this->ga->getAllTimeSummery();
$lastmonth = date('Y-m-d', strtotime('-30 days'));
//Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates
$data['summery'] = $this->ga->getSummery($lastmonth, $now);
//All time summery: visitors, page views
$data['allTimeSummery'] = $this->ga->getAllTimeSummery();
//Last 10 days visitors (for graph)
$data['visits'] = $this->ga->getVisits(date('Y-m-d', strtotime('-10 days')), $now, 10);
//Top 10 search engine keywords
$data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10);
//Top 10 visitor countries
$data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10);
//Top 10 page views
$data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10);
//Top 10 referrer websites
$data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10);
//Top 10 visitor browsers
$data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10);
//Top 10 visitor operating systems
$data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10);
$this->load->view("inc_statistic", $data);
}
示例12: replace
/**
* Replace all of the default date fields.
*
* @param String The tagdata to be parsed
* @param Object The channel parser object
* @param Mixed The results from the preparse method
*
* @return String The processed tagdata
*/
public function replace($tagdata, EE_Channel_data_parser $obj, $date_vars)
{
$prefix = $obj->prefix();
$tag = $obj->tag();
$data = $obj->row();
$dates = array($prefix . 'entry_date' => $data['entry_date'], $prefix . 'edit_date' => mysql_to_unix($data['edit_date']), $prefix . 'recent_comment_date' => $data['recent_comment_date'] != 0 ? $data['recent_comment_date'] : '', $prefix . 'expiration_date' => $data['expiration_date'] != 0 ? $data['expiration_date'] : '', $prefix . 'comment_expiration_date' => $data['comment_expiration_date'] != 0 ? $data['comment_expiration_date'] : '');
// "week_date"
// Subtract the number of days the entry is "into" the week to get zero (Sunday)
// If the entry date is for Sunday, and Monday is being used as the week's start day,
// then we must back things up by six days
$offset = 0;
if (strtolower(ee()->TMPL->fetch_param('start_day')) == 'monday') {
$day_of_week = ee()->localize->format_date('%w', $data['entry_date']);
if ($day_of_week == '0') {
$offset = -518400;
// back six days
} else {
$offset = 86400;
// plus one day
}
}
$dates['week_date'] = $data['entry_date'] - ee()->localize->format_date('%w', $data['entry_date'], TRUE) * 60 * 60 * 24 + $offset;
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates);
$dates = array($prefix . 'gmt_date' => $data['entry_date'], $prefix . 'gmt_entry_date' => $data['entry_date'], $prefix . 'gmt_edit_date' => mysql_to_unix($data['edit_date']));
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates, FALSE);
return $tagdata;
}
示例13: datediff
function datediff($datefrom, $dateto = FALSE)
{
$startDate = mysql_to_unix($datefrom);
$lastDate = $dateto ? mysql_to_unix($dateto) : now();
$differnce = $startDate - $lastDate;
$differnce = $differnce / (60 * 60 * 24);
return (int) $differnce;
}
示例14: get_timespan
public function get_timespan($time)
{
$time = mysql_to_unix($time);
//$time -= -3600;
return $this->time_since($time);
//return $time;
//return timespan($time, $now);
}
示例15: post_comments
public function post_comments($post_id = 0)
{
// load date_helper from CI's app singleton
get_instance()->load->helper('date');
$comments = $this->db->where('post_id', (int) $post_id)->order_by('created DESC')->get('comments')->result_array();
return array_map(function ($a) {
$a['time_ago'] = timespan(mysql_to_unix($a['created']), time(), 2);
return $a;
}, $comments);
}