Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

conversion of ddmmyyyy format in yyyymmdd

Ajay PatelAjay Patel Posts: 13Member
Since i am using Mysql which stores date in formate yyyymmdd, i want to convert format ddmmyyyy into mysql format to store date in database.How can i write the code in java script.help me

Comments

  • zibadianzibadian Posts: 6,349Member
    : Since i am using Mysql which stores date in formate yyyymmdd, i want to convert format ddmmyyyy into mysql format to store date in database.How can i write the code in java script.help me
    :
    Use the charAt() method of the string to access the individual characters. Then you can add those chars together in any order to create a new string with the desired format.
  • Ajay PatelAjay Patel Posts: 13Member
    : : Since i am using Mysql which stores date in formate yyyymmdd, i want to convert format ddmmyyyy into mysql format to store date in database.How can i write the code in java script.help me
    : :
    : Use the charAt() method of the string to access the individual characters. Then you can add those chars together in any order to create a new string with the desired format.
    : thanx
    i am written check function in my jsp file to convert it into format at onSubmit event that is as fallows;

    function check() {

    date1 = new Array[9];
    date1 = document.Entry_Form.From_Date.value;
    day = new Array[2];
    day = date1.substring(0,1);
    month= new Array[2];
    month= date1.substring(3,4);
    year = new Array[4];
    year = date1.substring(6,9);
    document.Entry_Form.From_Date.value = '' + day + month + year;
    }
    but it is not working in servlet i am taking date value as i define From_Date;
    how can i use charAt Function
    please help me


  • aaronjones3593aaronjones3593 Posts: 122Member
    [code][red]var day = date1.charAt(index_of_integer);[/red][/code]
    : : : Since i am using Mysql which stores date in formate yyyymmdd, i want to convert format ddmmyyyy into mysql format to store date in database.How can i write the code in java script.help me
    : : :
    : : Use the charAt() method of the string to access the individual characters. Then you can add those chars together in any order to create a new string with the desired format.
    : : thanx
    : i am written check function in my jsp file to convert it into format at onSubmit event that is as fallows;
    :
    : function check() {
    :
    : date1 = new Array[9];
    : date1 = document.Entry_Form.From_Date.value;
    : day = new Array[2];
    : day = date1.substring(0,1);
    : month= new Array[2];
    : month= date1.substring(3,4);
    : year = new Array[4];
    : year = date1.substring(6,9);
    : document.Entry_Form.From_Date.value = '' + day + month + year;
    : }
    : but it is not working in servlet i am taking date value as i define From_Date;
    : how can i use charAt Function
    : please help me
    :
    :
    :

  • aaronjones3593aaronjones3593 Posts: 122Member
    [b][red]This message was edited by aaronjones3593 at 2005-7-24 10:58:30[/red][/b][hr]
    : : : Since i am using Mysql which stores date in formate yyyymmdd, i want to convert format ddmmyyyy into mysql format to store date in database.How can i write the code in java script.help me
    : : :
    : : Use the charAt() method of the string to access the individual characters. Then you can add those chars together in any order to create a new string with the desired format.
    : : thanx
    : i am written check function in my jsp file to convert it into format at onSubmit event that is as fallows;
    :
    : function check() {
    :
    : date1 = new Array[9];
    : date1 = document.Entry_Form.From_Date.value;
    : day = new Array[2];
    : day = date1.substring(0,1);
    : month= new Array[2];
    : month= date1.substring(3,4);
    : year = new Array[4];
    : year = date1.substring(6,9);
    : document.Entry_Form.From_Date.value = '' + day + month + year;
    : }
    : but it is not working in servlet i am taking date value as i define From_Date;
    : how can i use charAt Function
    : please help me
    :
    :
    :
    Or you could try:

    [code]

    text = "";
    str = "text to be reversed here";
    for (i = 0; i <= str.length; i++)
    text = str.substring(i, i+1) + text;
    // Your output value is in the variable "text"
    [/code]
    If that doesnt work, the take the = sign out of the For... loop after the i = 0; bit

Sign In or Register to comment.