Howdy, Stranger!

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

Categories

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.