sjehanzeb
asked on
date
hi,
i have many field in my table, and i wanted to display the date in my order. i know it's done by like this..
select date_format(date_field, "date format") from table
but i don't want to specify field , all my fields should be in my suggested order.
thanks
i have many field in my table, and i wanted to display the date in my order. i know it's done by like this..
select date_format(date_field, "date format") from table
but i don't want to specify field , all my fields should be in my suggested order.
thanks
sjehanzeb,
can you eloborate a bit on what you need here.
many thanks
Peewee
can you eloborate a bit on what you need here.
many thanks
Peewee
Hi Kelfink,
we can format the date in the query itself...
we can format the date in the query itself...
Hi,
visit the following URL
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
u will find the solution for u r query
visit the following URL
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
u will find the solution for u r query
ASKER
hi,
i have to user
select * from ......
but i want the date fields in the table in my format
i have to user
select * from ......
but i want the date fields in the table in my format
Sounds like a great thing to be request of mysql Support, but, as I said, it looks to be impossible right now.
just get the date ..and parse it ..in ur format ...
Lk
Lk
kelfink is absolutely right, you can't do this only in SQL - you have to convert date yourself or specify date format in query (*, date_format()) or store data as a string in your favorite format (it's the worst idea)
Just do:
SELECT *, DATE_FORMAT(date_field, '&d.&m.%Y') as date_field FROM ...
And you get all the fields plus your date_field formattet as you like it. But then your date_field will be the last in order.
pp
SELECT *, DATE_FORMAT(date_field, '&d.&m.%Y') as date_field FROM ...
And you get all the fields plus your date_field formattet as you like it. But then your date_field will be the last in order.
pp
ASKER
i have worked around....
and the secound idea is to get date from mysql ...
and then convert it into the php date system(i m using php),
but it's possible only in php timestamp..
and timestamp doesn't take dates older than 1970
and the secound idea is to get date from mysql ...
and then convert it into the php date system(i m using php),
but it's possible only in php timestamp..
and timestamp doesn't take dates older than 1970
U can parse from u r PHP..that is a real good idea that converting from mysql.
regards
VasanS
regards
VasanS
did u got it??
ASKER
doing it form the php side...
i already asked the question in php section
copy string date to php date Date: 04/18/2002 10:36AM PST
https://www.experts-exchange.com/jsp/qShow.jsp?ta=php&qid=20291056
i already asked the question in php section
copy string date to php date Date: 04/18/2002 10:36AM PST
https://www.experts-exchange.com/jsp/qShow.jsp?ta=php&qid=20291056
why you don't you use unix_timestamp?
you can set the timestamp in your table und read with from_unixtime("%d.%m.%Y",Y OUR_STAMP) .
its very easy.
you can set the timestamp in your table und read with from_unixtime("%d.%m.%Y",Y
its very easy.
ASKER
caz unix timestamp does not take dates before 1970s....
that was the main problem
that was the main problem
now i hope this funktion help you.
function datum($_dat) {
// Wandelt timestamp String in Datum und Uhrzeit um.
$datum=intval(substr($_dat ,6,2))."." .intval(su bstr($_dat ,4,2))."." .substr($_ dat,0,4)." um ".substr($_dat,8,2).":".su bstr($_dat ,10,2).":" .substr($_ dat,12,2);
return $datum;
}
changes a timestamp like this 2002-05-20 in 20.05.2002
function datum($_dat) {
// Wandelt timestamp String in Datum und Uhrzeit um.
$datum=intval(substr($_dat
return $datum;
}
changes a timestamp like this 2002-05-20 in 20.05.2002
sjehanzeb,
No comment has been added lately (550 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: PAQ/No Refund
Please leave any comments here within 7 days.
-- Please DO NOT accept this comment as an answer ! --
Thanks,
Squeebee
EE Cleanup Volunteer
No comment has been added lately (550 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: PAQ/No Refund
Please leave any comments here within 7 days.
-- Please DO NOT accept this comment as an answer ! --
Thanks,
Squeebee
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can format the dates in your client environment, however there are no choices in the 'mysql' command tool to format date columns.