Datetime format
Moderator: General Moderators
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
Datetime format
I have a mySQL datetime field that I am populating with the SQL now() funtion. The result I get when I pull that out of the database is something like:
2004-03-16 09:58:03
What I want is something like:
Mar 16, 9:58 am
I have looked at date() and strtotime() and mySQL's date_format, but for some reason I am getting very confused. I don't need the code to do it, but an idea of which one of these I should use to do it would help me greatly. That way I can take it and play around with it until I get it working the way I want.
Thanks,
John
2004-03-16 09:58:03
What I want is something like:
Mar 16, 9:58 am
I have looked at date() and strtotime() and mySQL's date_format, but for some reason I am getting very confused. I don't need the code to do it, but an idea of which one of these I should use to do it would help me greatly. That way I can take it and play around with it until I get it working the way I want.
Thanks,
John
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
If I use the date() function, would my searches still work properly if I sorted by date? I'm using this for a shoutbox, so I like using the now() function for putting it into the database, I just want to change the output. I'm sure that I could use preg_replace somehow, but that looks even more confusing than any of the date functions.
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm