×

Error

Please login first

[SOLVED] Query expiry date of subscription plan

11 years 6 months ago - 11 years 6 months ago #213659 by dotcom22
hello

I would like get the expiry date of subscription plan for let me display this data in various place using substitutions.

For do that, I created a Query field "cb_expirydate" with inside the following SQL code:

SELECT `expiry_date` FROM `mytable_cbsubs_subscriptions` WHERE `user_id` = [user_id]


Then I created a Delimiter field with inside [cb_expirydate] and the date is now displayed but under the format 2012-11-23 01:04:50. My goal would be to format the date differently so I tried the follow substitution:

[cb:date format="d M Y" field="cb_expirydate" /]

AND

[cb:userdata field="cb_expirydate" date format="d M Y" /]

..but none of them work...

It seem date substitution can't be used with another substitution so I must probably adapt my query but I don't know how.

Any clue please ?

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

11 years 6 months ago #213667 by krileon
Replied by krileon on topic Re: Query expiry date of subscription plan
Such a substitution doesn't exist, not sure where you obtained such a thing. You need to format it in your query. Please see the below.
SELECT DATE_FORMAT( `expiry_date`, '%d %b %Y' ) FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[user_id]'

Please see the below MySQL documentation for further usage of date format function.

dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_date-format


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

11 years 6 months ago #213684 by dotcom22
Replied by dotcom22 on topic Re: Query expiry date of subscription plan
Great your query work like expected, many thank. :silly: :woohoo:

Such a substitution doesn't exist, not sure where you obtained such a thing.


I simply tried to make a mix using different example published on your tutorial... :S

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

11 years 6 months ago #213718 by krileon
Replied by krileon on topic Re: Query expiry date of subscription plan

I simply tried to make a mix using different example published on your tutorial..

I wish that worked as it'd provide some interesting combinations and results. :laugh: Maybe something to consider for the future.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.206 seconds

Facebook Twitter LinkedIn