PHP删除点和连字符 [英] PHP remove dots and hyphens

查看:81
本文介绍了PHP删除点和连字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我需要同时删除变量时间和日期中的点和连字符。

Hello I need to remove dots and hyphens from both variables time and date.

这是我的代码:

$todaydate = date('Y-m-d') ."\n";
$time_utc=mktime(date('G'),date('i'),date('s'));
$NowisTime=date('G:i:s',$time_utc);

返回的内容如下:

$todaydate = 2011-06-03
$NowisTime = 14:20:30

我需要实现的是:

$todaydate = 20110603
    $NowisTime = 142030

我该怎么做?

谢谢

推荐答案

您可以这样做:

$todaydate = date('Ymd');
$time_utc=mktime(date('G'),date('i'),date('s'));
$NowisTime=date('Gis',$time_utc);

这篇关于PHP删除点和连字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆