This topic is locked

How to display current time

1/8/2007 3:45:47 PM
PHPRunner General questions
N
Norian author

Hello,
I am currently having a problem getting a timestamp for one of my fields. I have a time field in my table and would like it to automatically add the time in 24hr format. I have tried the now() function however that gives the time and date. I have also tried the time() function but that just gives the unix number for the current time. I would like to know how I can get it so that I can get the current time and display it in 24hr clock format so I can automatically have a timestamp for the field?
Many thanks and sorry if I havent explained what I need very well, I am just starting out with PHP <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=4334&image=1&table=forumtopics' class='bbc_emoticon' alt=':unsure:' />

L
larsonsc 1/8/2007

Try using this:

date("H:i:s")


I think I have the formatted correctly anyway.

N
Norian author 1/9/2007

Try using this:


date("H:i:s")


I think I have the formatted correctly anyway.


Thank you, that worked a treat... easy when you know how <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=14447&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />

L
larsonsc 1/9/2007

Glad to hear that worked for you. I'm only knowledgable about the kind of default data strings and such I have run into issues with myself! I spend a lot of time on the php.net page looking up functions. And even then I usually goof them up a few times. ;-) You'll get the hang of it faster than you think though. Once you do a few of them, it seems to just start to flow.