TOPIC:

Convert date to save on table 7 years 11 months ago #134363

  • Topic Author
  • leonardo.almeida
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 35
  • Thanks: 0
The user choose the date and show this way:
%d / %m / %Y

When I need save this date on table, he need save this way:
$Y-%m-%d

I only modify for appear the first format to user.
When he save on table, appear 0000-00-00

How can I convert this first format to second after user confirm to save on table?

Thanks for try help me! :D:D

Please Log in or Create an account to join the conversation.

Convert date to save on table 7 years 11 months ago #134365

  • chrisal's Avatar
  • chrisal
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 6983
  • Karma: 187
  • Thanks: 630
Hello leonardo,


do you want to save the date as an element value or as a part of the records itself?(records or subrecords table?)

The easiest workaround would be to use two different elements so you can use Javascript to cahnge the format.


regards
Chris

Please Log in or Create an account to join the conversation.

Convert date to save on table 7 years 11 months ago #135059

  • Topic Author
  • leonardo.almeida
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 35
  • Thanks: 0
Sorry for delay answer.
Thanks to answer, chrisal.

The date choice by user appear %d / %m / %Y.
I need help to convert these format date (%d / %m / %Y) to save on other table with these format (%Y-%m-%d) after user confirm.

P.S:
I use the BreezingForms Integrator to "pass" the date.

Please Log in or Create an account to join the conversation.

Last edit: Post by leonardo.almeida.

Convert date to save on table 7 years 10 months ago #135206

  • chrisal's Avatar
  • chrisal
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 6983
  • Karma: 187
  • Thanks: 630
Hello again,


copy the following code:
var val = element.value;
val = val.split('/');
var nval = val[2]+'-'+val[1]+'-'+val[0];
ff_getElementByName('newDate').value = nval;

into the Actionscript(change) of the date element.(Don't forget to create the code Framework|code below case: 'change')

Afterwards create a new Element(hidden input) and name it 'newDate'. Now you can use this element to "pass" the converted date to the database.


regards
Chris

Please Log in or Create an account to join the conversation.

Convert date to save on table 4 years 9 months ago #222613

  • knoblauchschaf
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0

chrisal wrote: Hello again,


copy the following code:

var val = element.value;
val = val.split('/');
var nval = val[2]+'-'+val[1]+'-'+val[0];
ff_getElementByName('newDate').value = nval;

into the Actionscript(change) of the date element.(Don't forget to create the code Framework|code below case: 'change')

Afterwards create a new Element(hidden input) and name it 'newDate'. Now you can use this element to "pass" the converted date to the database.


regards
Chris


Hello,

is that no longer possible?

I'm using Version 1.9.0 Stable (929)

Please Log in or Create an account to join the conversation.

Convert date to save on table 4 years 9 months ago #222797

  • JulianGracin's Avatar
  • JulianGracin
  • Offline
  • Developer
  • Developer
  • Posts: 673
  • Karma: 33
  • Thanks: 66
Hi Knoblauchschaf,

Sorry for the delayed answer. You have posted on an old topic. It's better to create a new topic, than to resurrect an old one. You'd be getting a quicker response. But never mind that now, let's see how can I help you.

I assume you want the same thing the Leonardo wants, to change the format of the date that is being stored in the database. How are you selecting the date and formatting the display? Are you using the calendar or textfield element?
If you are using a calendar, you could change the Format of the date, and it should be stored in the table in the format you have chosen. If you can't do it that way, let me know and we'll think of something.


Regards,
Julian
=========================================
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!