Postgres has lots of date manipulation functions. So, you should be able to use them to get/set the timestamp to a format that is suitable for whatever you are doing in JS. Look at the date/time functions in the postgres manual. The odbc stuff from squirrelmonkey just gives you the textual representation of whatever you ask for. There is no native type binding. If the Date() datatype takes a constructor then pull the date from the database in an appropriate format. For setting date from a JS Date() you'll want to see what format Date() can give you and look at the timestamp casting / construction possibilities. On Tue, Jun 15, 2010 at 4:37 PM, David Swardstrom < dswardstrom@remotelink.com> wrote:
I am working with Javascript and Freeswitch to emulate some Conferencing capability that the company I am working for has in production using other products.
One thing that I need to do is to access a timestamp from a database in JS. In pgAdmin for Postgres this is a "timestamp without time zone".
In JS there is a data type called Date.
Question: If I read a row of the database which includes this timestamp field, what should I put it into? * Can I put it directly into a Date data type? * Does it have to come out as a string or a number? * If it is a number can I then put it into a Date? * If it is a string, what is the format: Is it: "YYYY-MM-DD HH:MM:SS.ffffff"?
I looked in mod_spidermonkey_odbc.c pdbc_next_row() and it appears to call SQLFetch() and return the result. But information on a row contains both a value but it's type, so what will the interpreter do?
If anyone knows, let me know, otherwise I will incorporate a way to test this into my code and let everyone know (may also add this to some Wiki).
Regards, David Swardstrom (profile)http://wiki.freeswitch.org/wiki/User:Dswardstrom
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- -Rupa