View Full Version : date format
varshatest
01-03-2007, 11:39 AM
hi all,
i have date stored in database in yyyy-mm-dd format..
bt while displaying on page i wanna display in d-m-yyyy fomat...
how do i do tht?
like eg.....
event_date=2007/01/20-------saved in database..
bt i want to display like 20th Jan 2007....
similiarly for time...in database it is saved as 02:30:00....
bt i want to display it as 02:30 AM....
hw do i do this?
its urgent
regrds
varsha
mike_p
01-03-2007, 12:00 PM
if using a sql database (eg mysql) change the date format in your query.
eg
SELECT DATE_FORMAT(mydatefield, '%D %b %Y') from mytable
where mydatefield is the date field name and mytable is the table.
look here for all the details:
http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html
varshatest
01-04-2007, 05:07 AM
hey thnks a lot...
i tried tht it..works..well...
thnks...cu.
varsha
if using a sql database (eg mysql) change the date format in your query.
eg
SELECT DATE_FORMAT(mydatefield, '%D %b %Y') from mytable
where mydatefield is the date field name and mytable is the table.
look here for all the details:
http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html
nicksalad
01-21-2007, 05:09 PM
Hi, im new here, nice forum!
i got a problem... What about if you want to run a script every monday, everytime a user log in, like a monday's surprice ;)
if (date("D") == 'Mon') {
RUN SCRIPT; }
else { NOTHING }
the problem is, with this method the user could change their computer time and get the surprice any day at any time, just need to change their computer date to monday. How can i do to instead of check for the user's time, to check the time of the server where the website is hosted?
Thanks!
BLiZZaRD
01-21-2007, 05:44 PM
Answered in the other thread :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.