想打印一整天的全名 [英] want to print full Name of the day

查看:125
本文介绍了想打印一整天的全名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如:

 <?php 
echo date(1);
?>

并希望获得输出为星期一。但它打印 1



可以帮助我吗?

解决方案

 code> echo date('l'); 

令人惊奇的是,您在手册中找到了,它不是1


l(小写'L')星期日到星期六
周的全文本表示


更新



悄悄不必创建自己的日期数组

  $ day ='1'; 
echo date(l,mktime(0,0,0,8,$ day,2011)); //它将适用于第1-7天


I want to print name of the day giving numbers from 1 to 7.

Ex:

<?php
 echo date("1");
?>

and want to get output as Monday. But it prints 1.

Can any one help me?

解决方案

echo date ('l');

amazing what you find in the manual, its l not 1

l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday

update

sneakiness to not have to create your own array of day names

$day='1'; 
echo date("l", mktime(0,0,0,8,$day,2011));// it will work for day 1-7 

这篇关于想打印一整天的全名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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