DATE function - Space problem

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
vamsinadella
Forum Newbie
Posts: 15
Joined: Fri Dec 22, 2006 6:05 pm

DATE function - Space problem

Post by vamsinadella »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I need  to populate a text filed with todays date. As simple it is, i use date('Y m d h:m:s'). BUT THIS won't work. If i remove the spaces between the attributes, then it works fine. or i have to put a '-' between them. Well, the '-' works fine for date, like: 2005-12-28, but what can i do for the space i NEED between time and date. Currently i'm using a '.' and it looks awkward. Somehing like: 2006-12-28.02:41:32(notice the '.' between date and time). I just want to eliminate the '.' and use a space, but it's not letting me. I have never seen this problem. I know i'm doing something wrong. Can anyone throw some intel info on this?

code snippet:

Code: Select all

<?php
 $today = date('Y-m-d.h:m:s');
 echo $today;
?>
Help is greatly appreciated.....Thanks.

- Vamz


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Tag attribute values must be contained in quotes.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Good catch, feyd! I didn't even get what you were saying for a minute.

For vamsinadella's reference: he means in the html input element, not in PHP:

Code: Select all

<input name="date" value="<?=date('Y m d h:m:s')?>" />
Post Reply