Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:16:31+00:00 2026-06-14T23:16:31+00:00

I am using the p4a application framework and I have build several databases one

  • 0

I am using the p4a application framework and I have build several databases one of which needs to gather the date of a booking, I understand that there Isn’t a way to do this through MySQL but I haven’t found anything useful on the p4a forums on this so anyone that uses the p4a framework that could help, I would be grateful,

I have my local set as en_GB which sets the date within the p4a field as dd-mm-yyyy but I need it to be yyyy-mm-dd to actually write the data into the database,

the present code for this operation is:

$this->build("p4a_field","date")
         ->setlabel("Date")
         ->setType('date')

$location = $this->AreaName->getNewValue();
    $date = $this->date->getNewValue();
    $merono = $this->merono->getNewValue();

    $p4a = p4a::singleton();


$p4a->i18n->autoUnformat($date, "shortdate");

    p4a_db::singleton()->query("INSERT INTO meetingrooms(location, date, merono)
        VALUES
        ('$location', '$date', '$merono')");

Any help would be appreciated, I was planning on intercepting the function using afterClick but I need to know the syntax required first.

Thanks,

Steve

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:16:32+00:00Added an answer on June 14, 2026 at 11:16 pm

    If I understand correctly, you have some dates in a non-MySQL-friendly format, but you want to use them for INSERTs, right?

    How about letting MySQL convert them for you?

    SELECT STR_TO_DATE('31-12-2012','%d-%m-%Y');
        -> '2012-12-31'
    

    EDITS:

    It looks like you have the date:

    $date = $this->date->getNewValue();
    

    so you need to use the formula in your SQL:

    p4a_db::singleton()->query("INSERT INTO meetingrooms(location, date, merono)
    VALUES
    ('$location', STR_TO_DATE('$date','%d-%m-%Y'), '$merono')");
    

    I’m not a p4a guy, so hopefully that’ll work.

    Note that, in most languages, you’ll be exposed to SQL injection with code like that. Does p4a cover that for you, or provide for positional parameters?

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make Widgets using P4A Application framework and i have a reflectively
I'm using the p4a application framework, i need to insert rows into my database
Using MVC2 I have an AJAX form which is posting to a bound model.
Using: Visual Studio 2010 with ASP.net 4.0 I have a website which uses URL
Using MVVM. I have a DataTemplate which I am using to display an expander
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using import datetime in python, is it possible to take a formatted time/date string
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
Using mercurial, I've run into an odd problem where a line from one committer
Using Android TelephonyManager an application can obtain the state of data activity over the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.