Jump to content

PHP date question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
GMailGuy

GMailGuy

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
Hi there. I was reading an ebook about PHP and I want to learn it and I encountered this:

[HIGHLIGHT="PHP"]The time is
<?php echo date('H:i:s');?>
and the date is
<?php echo date('j F Y');?>
[/HIGHLIGHT]

What does the H, i, s, j,F, Y mean?

I mean ok the :
H = Hour (I think 24 hour clock as it's capital)
s = seconds
Y= year

but how am I supposed to know the others? Do those mean anything? or just letters that the people that invented PHP chose?

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
There's a description about the date()-function on this page, including descriptions of each letter...
PHP: date - Manual

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
j = Day of the month without leading zeros
F = A full textual representation of a month, such as January or March
i = Minutes with leading zeros

When programming with PHP your best resource will be PHP: Hypertext Preprocessor

#4
GMailGuy

GMailGuy

    Learning Programmer

  • Members
  • PipPipPip
  • 60 posts
Thanks :)

It's gonna be hard to remember all those letters...

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I doubt anyone remembers all of them, I sure as heck don't. But you can always check the PHP manual for reference.

#6
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I can't remember them at all. I always use the manual. But I'm not working with it often neither.

#7
ReekenX

ReekenX

    Programmer

  • Members
  • PipPipPipPip
  • 134 posts
Full descriptions of values is in php manual you can find online: PHP: date - Manual
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx

#8
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Okay.. here's one nice link also..
PHP date() function

i think this will help you 100% ;)

#9
Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guests
It is impossible to remember all of these. Once you know PHP you will use php.net more than anything else.

#10
ReekenX

ReekenX

    Programmer

  • Members
  • PipPipPipPip
  • 134 posts
Well, after 4 web developing I am using PHP manual very rarely... But still using :)
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx

#11
Gabriel

Gabriel

    Learning Programmer

  • Members
  • PipPipPip
  • 39 posts
W3Schools Online Web Tutorials is good too ^_^
I'm an angel. I kill firstborns while their mamas watch. I turn cities into salt. I even, when I feel like it, rip the souls from little girls, and from now till kingdom come, the only thing you can count on in your existence is never understanding why.
-
Do you know how you got that dent, in your top lip? Way back, before you were born, I told you a secret, then I put my finger there and I said "Shhhhh!"
-
Quotes taken from The Prophecy (1995)

#12
ReekenX

ReekenX

    Programmer

  • Members
  • PipPipPipPip
  • 134 posts
Gabriel, Jaan has already written this link 2 messages before you.
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx