Re: [jQuery] New Plugin: ODBCDate functions
Hi there. Your JS code link is dead! :) cjordan wrote: Hi folks, Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid JavaScript Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. They're simple, and I'll work on adding a bit more functionality (either as I need it, or as the community responds with the need), but for now, I just threw it together. Here's my little demo http://cjordan.info/jquery/ODBCDateDemo.cfm page. Check it out, and comment if you like. As the page says: it's my first plug-in so be gentle! :o) G'night folks. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/New-Plugin%3A-ODBCDate-functions-tf2599770.html#a7255399 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
Hi, [I'm usually a lurker, this is my first response - been using JQuery for a couple of months now and loving it!] On 09/11/06, Christopher Jordan [EMAIL PROTECTED] wrote: Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid JavaScript Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. I cheked out your plugin, and the conversion from ODBCDateTime to a JS string worked fine, but the 'JS to ODBCDatetime' function threw up a problem when I tried it/ My current system time came up as: 106-11-9 10:50:59 That puts me in the Iron Age! (My system clock appears to be correct elsewhere. Otherwise, great - and useful - addition. Regards, Louise Dade -- www.classical-webdesigns.co.uk ~ Complete Website Design. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
The problem is the plugin uses d.getYear() which returns the current year minus 1900. To get the actual year that line should be changed to d.getFullYear(). Quick fix until the plugin gets officially updated. -blair Louise Dade wrote: Hi, [I'm usually a lurker, this is my first response - been using JQuery for a couple of months now and loving it!] On 09/11/06, Christopher Jordan [EMAIL PROTECTED] wrote: Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid JavaScript Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. I cheked out your plugin, and the conversion from ODBCDateTime to a JS string worked fine, but the 'JS to ODBCDatetime' function threw up a problem when I tried it/ My current system time came up as: 106-11-9 10:50:59 That puts me in the Iron Age! (My system clock appears to be correct elsewhere. Otherwise, great - and useful - addition. Regards, Louise Dade ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
oops! fixed. :o) Thanks Dan! Chris Dan Atkinson wrote: Hi there. Your JS code link is dead! :) cjordan wrote: Hi folks, Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid _javascript_ Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. They're simple, and I'll work on adding a bit more functionality (either as I need it, or as the community responds with the need), but for now, I just threw it together. Here's my little demo http://cjordan.info/jquery/ODBCDateDemo.cfm page. Check it out, and comment if you like. As the page says: it's my first plug-in so be gentle! :o) G'night folks. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
Louise, Thanks for catching that. I thought I'd checked all the code in both IE and FF(2.0), but missed that one. I was using getYear() instead of getFullYear(). I didn't realize the difference between the two. Anyway, it's fixed now. Thanks again! Chris Louise Dade wrote: Hi, [I'm usually a lurker, this is my first response - been using JQuery for a couple of months now and loving it!] On 09/11/06, Christopher Jordan [EMAIL PROTECTED] wrote: Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid _javascript_ Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. I cheked out your plugin, and the conversion from ODBCDateTime to a JS string worked fine, but the 'JS to ODBCDatetime' function threw up a problem when I tried it/ My current system time came up as: 106-11-9 10:50:59 That puts me in the Iron Age! (My system clock appears to be correct elsewhere. Otherwise, great - and useful - addition. Regards, Louise Dade ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
I've experienced many problems when converting date from database to usable format, so your work is great. But copying date taken after pressing Current time, from: Current Time in ODBCDateTime format: {ts '2006-11-9 14:57:5'} and pasting it into Enter a string to convert box, gives an error: invalid odbc date format Correcting date string to {ts '2006-11-09 14:57:05'} (leading zeros in day and seconds) gives proper answer: Sat Dec 9 14:57:05 UTC+0100 2006 I do not know whether your output procedure is not up to format, or your input procedure is too rigorous, but it shouldn't be that way... Regards, Krzysztof -- View this message in context: http://www.nabble.com/New-Plugin%3A-ODBCDate-functions-tf2599770.html#a7258647 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
Krzysztof, You're right. I am expecting the digits in the time format to have leading zeros, because I thought that was the "proper" ODBC format. But I should allow single digits, and prepend the zero. Good suggestion. I'll implement that in a few minutes. Thanks, Chris Krzysztof FF wrote: I've experienced many problems when converting date from database to usable format, so your work is great. But copying date taken after pressing "Current time", from: Current Time in ODBCDateTime format: {ts '2006-11-9 14:57:5'} and pasting it into Enter a string to convert box, gives an error: "invalid odbc date format" Correcting date string to {ts '2006-11-09 14:57:05'} (leading zeros in day and seconds) gives proper answer: Sat Dec 9 14:57:05 UTC+0100 2006 I do not know whether your output procedure is not up to format, or your input procedure is too rigorous, but it shouldn't be that way... Regards, Krzysztof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: ODBCDate functions
Hi folks, Per Krzysztof's suggestion I've added the ability to pass ODBCDateTime strings that are missing leading zeros in the month, day, hours, minutes or seconds. In the case of seconds, if you intend "00" you can leave it off entirely (including the preceding colon). The year must still be a full four digit year and minutes cannot be left out. If you intend zero minutes you'll have to include (at least) ":0". Of course, to indicate midnight use "0:" or "00:" as the hours. I think that I'll still add on to this plug-in the ability to work with ODBCDates (without the time) and ODBCTimes (without the date) Their format is {d '-mm-dd'} or {t 'hh:mm:ss'} respectively. In the case of the ODBCDate I'll assume midnight on that date (00:00:00), and in the case of ODBCTime I'll assume the current date. I'll try to get those added later this afternoon or tonight. Examples: {ts '2006-4-1 2:5'} {ts '2006-4-01 2:5'} {ts '2006-04-01 02:5:0'} {ts '2006-04-1 02:5:00'} {ts '2006-4-10 2:55:00'} Again, you can get the plug-in here. Cheers, Chris Christopher Jordan wrote: Krzysztof, You're right. I am expecting the digits in the time format to have leading zeros, because I thought that was the "proper" ODBC format. But I should allow single digits, and prepend the zero. Good suggestion. I'll implement that in a few minutes. Thanks, Chris Krzysztof FF wrote: I've experienced many problems when converting date from database to usable format, so your work is great. But copying date taken after pressing "Current time", from: Current Time in ODBCDateTime format: {ts '2006-11-9 14:57:5'} and pasting it into Enter a string to convert box, gives an error: "invalid odbc date format" Correcting date string to {ts '2006-11-09 14:57:05'} (leading zeros in day and seconds) gives proper answer: Sat Dec 9 14:57:05 UTC+0100 2006 I do not know whether your output procedure is not up to format, or your input procedure is too rigorous, but it shouldn't be that way... Regards, Krzysztof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] New Plugin: ODBCDate functions
Hi folks, Today, I was in need of a function to parse strings in the ODBCDateTime format. I needed to convert a string in the ODBCDateTime format to a valid _javascript_ Date object, and vise versa. So instead of just writing the functions for me, I decided to make them a plugin for jQuery. They're simple, and I'll work on adding a bit more functionality (either as I need it, or as the community responds with the need), but for now, I just threw it together. Here's my little demo page. Check it out, and comment if you like. As the page says: it's my first plug-in so be gentle! :o) G'night folks. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/