从日期创建存档 [英] Creating an Archive from Date

查看:76
本文介绍了从日期创建存档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一系列由用户发布到数据库中的新闻文章,其中一个字段是日期(2007/09/20)。是否有可能过滤掉结果并创建本年度文章的链接?然后还有2007年,2006年等文章的年份链接。


有人能指出我正确的方向吗?


谢谢


问候


Tom

Hi

I have a series of news articles that get published by a user into a database, one of the fields is the date (2007/09/20). Is it possible to filter out the results and create links to articles for the months of the current year? and then also have year links to articles in 2007, 2006 etc.

Can anyone point me in the right direction please?

Thank you

Regards

Tom

推荐答案

Heya,Tom。


可能最简单的方法是使用strtotime()和date():

Heya, Tom.

Probably the easiest way would be to use strtotime() and date():

展开 | 选择 | 换行 | 行号


谢谢你的帮助我完全陷入困境,从来不知道接近任务的方式,我无法在一分钟内测试脚本但是会尽快做。


假设我可以使用这一行来获得一年中的月份。


[PHP]

Thank You for your help I was completetly stuck and never knew which way to approach the task, I cannot test the script at the minute but will do ASAP.

An presumingly I can then use this line to obtain the months for the year.

[PHP]


archives [date('''',strtotime(
archives[ date( ''F'', strtotime(


这篇关于从日期创建存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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