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 » Mon Apr 04, 2016 1:28 pm

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: 15077
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten » Mon Apr 04, 2016 6:59 pm

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 » Tue Apr 05, 2016 8:10 am

member_since in faquser.

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

Re: DB Date Format

Post by Thorsten » Tue Apr 05, 2016 8:30 am

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 » Tue Apr 05, 2016 8:36 am

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 » Tue Apr 12, 2016 11:17 am

*bump*

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

Re: DB Date Format

Post by Thorsten » Wed Apr 13, 2016 6:36 pm

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 » Fri Apr 15, 2016 1:18 pm

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 » Thu Apr 21, 2016 2:29 pm

*bump*

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

Re: DB Date Format

Post by terryrogers » Wed May 04, 2016 3:05 pm

*bump*

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

Re: DB Date Format

Post by terryrogers » Mon May 09, 2016 2:38 pm

Thorsten, any joy producing a query for us?

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

Re: DB Date Format

Post by Thorsten » Mon May 09, 2016 3:25 pm

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: 15077
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: DB Date Format

Post by Thorsten » Sun May 15, 2016 11:28 am

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