day_month_year__hour_minute_second

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

day_month_year__hour_minute_second

Post by ddragas »

Hi all.

First I'm begginer so please don't lough on my problem.

What is function of getting date-time format so at the end, printed variable looks like this: day_month_year__hour_minute_second
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

date() is described in manual
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

thank you

I've found somthing about date

$localtime = mktime();// the current datetime as a timestamp

/* Display it as yyyymmdd */

$ddmmyyyy = date("d_m_Y__h_MIN_SEC", $localtime);

echo $ddmmyyyy;
echo "<br>\n";




And time?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

"d_m_Y__H_i_s"
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

And if you want $ddmmyyyy from current time you don't need $localtime. Personally I find it very difficult to remember all date() options. For this (and for reference in general) I downloaded chm format manual from http://www.php.net. It's easy to use windows help-file type manual with search and stuff. Highly recommended...
Post Reply