I need to convert the UNIX_TIMESTAMP()
output into a readable date and time for output in a table. Anyone know how to do this? or am I in the wrong area again?
GraficRegret
0
Junior Poster
Recommended Answers
Jump to Post$ts; // timestamp value echo date('j-n-Y h:i:s a', $ts);
Jump to PostThe date() function takes two arguments. The first argument specifies the date format you want the timestamp to be converted to. The second argument specifies the timestamp that will be converted. Without the second argument, how does the date() function know what the date is?
Jump to PostSorry GR. I'm totally lost with regard to what you're trying to do. This unix timestamp - are you storing it in the DB? The 'normal' date format - what's happening with this - from your code it looks as though you're storing this. Could you rephrase your needs / …
Jump to PostOK, store datetimes either as unix timestamp (INT) or datetime (DATETIME) - which will be in the Y-m-d H:i:s format. DO NOT store date/times in custom format if you can avoid it. Searching and comparing dates is then very difficult.
You can use a number of different php functions, e.g. …
All 17 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
GraficRegret
0
Junior Poster
diafol
GraficRegret
0
Junior Poster
GraficRegret
0
Junior Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
GraficRegret
0
Junior Poster
diafol
GraficRegret
0
Junior Poster
GraficRegret
0
Junior Poster
diafol
GraficRegret
0
Junior Poster
EvolutionFallen
107
Junior Poster
GraficRegret
0
Junior Poster
diafol
GraficRegret
0
Junior Poster
GraficRegret
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.