Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: SYSDATE() views
11-30-2006, 11:00 AM #1
- Join Date
- Nov 2006
- Thanked 0 Times in 0 Posts
Hi there, I currently store a timestamp in my database to keep track of the last time an entry was updated via the SYSDATE() SQL function.
I was wondering if there was an easy way to display this sysdate in a simple format
so instead of displaying 2006-11-30 04:46:51
it displays "30-Nov-06" or "Today" etc...
11-30-2006, 02:57 PM #2
Check out the date() php function.
Extract the date from your database, set it as a variable and format it with the date() function.
If you want it to say "Today" then just run a conditional that asks if date() is equal to date("d-M-y", $myDate). If so, then print "Today" instead of the date.
12-01-2006, 01:17 AM #3
- Join Date
- May 2002
- Perth Australia
- Thanked 92 Times in 90 Posts
or look at your DB's built in commands .. e.g. in MySQL you can
"SELECT DATE_FORMAT('timefield','%d-%M-%Y) as pretty_date FROM ...etcresistance is...
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)