DB Date Format

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

DB Date Format

Post by terryrogers »

What is the date format stored as in the database?

How can I convert it to a readable format with a SQL query?
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten »

Hi Terry,

depends in the table. For which table do you need the information?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

member_since in faquser.
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten »

phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

Ho could I retrieve that formatted in a dd/mm/yyyy format with a SQL statement?
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

*bump*
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten »

Hi,

that's hard, it's old crappy code I wrote long ago. Do you need it as SQL or would it be possible to use PHP, too?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

Really need a SQL query, not able to use PHP as we are connecting to the DB from a ODBC connection within a spreadsheet.
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

*bump*
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

*bump*
terryrogers
Posts: 14
Joined: Tue Mar 08, 2016 10:49 am

Re: DB Date Format

Post by terryrogers »

Thorsten, any joy producing a query for us?
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten »

Hi,

I did not forgot you, I'm quite busy preparing 2.8.28 and 2.9.0 final. Will work on your query after this. Sorry for the delay.

Refactoring of the date formats will be a target for 2.10 and 3.0. :)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten »

Hi,

here it is:

Code: Select all

SELECT
	user_id,
	CONCAT(SUBSTRING(member_since, 7, 2), '/', SUBSTRING(member_since, 5, 2), '/', SUBSTRING(member_since, 1, 4))
FROM
	faquser
WHERE
	user_id = 1;
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply