0

Is there any way to insert java-script function between the query ??

For example :: In an query, i have stored date of birth like this 10101990 in the database, it means 10/10/1990, but I have display it in-front of page but in certain format like 10.10.1990 by using one java-script function.

Please suggest me any way ??

4
  • 1
    Can you please clarify what you are doing? How does Javascript come into play in a SQL query? Commented Oct 12, 2010 at 12:10
  • Sorry Guys, I have given an generalized example. Actual format is like this. 1234567890, now i have an function which will convert the above statement into 1234.56.7890 & In database, 1234567860 is stored. But during display, I can use this function but issue is that i have to use this in between sql query ?? Commented Oct 12, 2010 at 12:32
  • Can you give a concrete example? The one in your question and the one in your question don't give a complete picture Commented Oct 12, 2010 at 12:59
  • why not just something like SUBSTRING: SUBSTRING(FieldName, 1, 4) || "." || SUBSTRING(FieldName, 5, 2) || "." || SUBSTRING(FieldName, 7) Commented Oct 12, 2010 at 17:49

2 Answers 2

1
  1. You should not be storing date as a string on the database. This might have a lot of issues. You have to store date as, well, a Date
  2. You have to fetch this using a query using a language like Java or PHP.
  3. When you get the date in the screen, you can format it in javascript, if required. However you can format it in PHP or Java. For java see SimpleDateformat.

See also this question.

Sign up to request clarification or add additional context in comments.

Comments

0

You can manipulate with data values in jquery6 just before display it like this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.