rcdmk / aspJSON

A fast classic ASP JSON parser and encoder for easy JSON manipulation to work with the new JavaScript MV* libraries and frameworks.
MIT License
203 stars 89 forks source link

date fields #17

Closed dtrillo closed 8 years ago

dtrillo commented 8 years ago

Hi. I am having issues when working with MySQL databases because of the function GetTimeZoneOffset.

It can be a good idea to configure how you want the date time result, and give the chance to offer data time in other format.

After modifying this lines, everything works fine! I added this private function: private Function BuildDate(fecha) tmp = "" if IsDate(fecha) then dia = day(fecha) mes = month(fecha) ano = year(fecha) hora = hour(fecha) minuto = minute(fecha) segundo = second(fecha) if len(hora) = 1 then hora = "0" & hora if len(minuto) = 1 then minuto = "0" & minuto if len(segundo) = 1 then segundo = "0" & segundo if len(dia) = 1 then dia = "0" & dia if len(mes) = 1 then mes = "0" & mes tmp = ano & "-" & mes & "-" & dia & " " & hora & ":" & minuto & ":" & segundo end if BuildDate = tmp end function

Now I have the time "yyyy-mm-dd HH:MM:SS"

You could add some properties in order to return functions using timezone or nor!

rcdmk commented 8 years ago

It's a nice idea to have an option to choose the date format, but I think it will not add much to this project.

Since this project aims at create standard JSON, the standard for JSON dates is "yyyy-mm-ddTHH:MM:SSZ", where T is a literal and Z is the time zone.

You can see this standard definition on https://en.wikipedia.org/wiki/ISO_8601

What are you trying to do when this date format causes you problems?

dtrillo commented 8 years ago

You're right about the format, but I do have problems with the dates when I use MySQL as database, and I don't know why.

rcdmk commented 8 years ago

I will take some time to investigate this. Do you get errors while trying to use the LoadRecordset(rs) and LoadSingleRecord(rs) methods?

What problems do you have?

dtrillo commented 8 years ago

LoadRecordset(rs) It give me an error on line 705 error '80041010'

rcdmk commented 8 years ago

I've done a test and the problem seems related to how this class obtains the time zone information from Windows. Since this works on my machine, I could not simulate the error yet.

What version of Windows are you running? Does this work when you add a date value to any property except when coming from MySQL?

dtrillo commented 8 years ago

I am running Windows XP and the server I'm using is Windows 2003 Server.

rcdmk commented 8 years ago

I'm testing some other methos to obtain the timezone. As soon I get something that can replace the actual implementation I will ask you to test it on your machine. OK?

dtrillo commented 8 years ago

Sure, no problem!

Z3R084 commented 8 years ago

I have the same problem. In my environment it's a security issue. On my local machine there is no problem, but remote i get an error (function GetTimeZoneOffset, get winmgts object). It seems to be a security problem (Unauthorized). Unfortunately, I can't change the security settings on the production server. Have you figured out any other way to get the offset, yet?

rcdmk commented 8 years ago

Hi. Thank you for the info. This is a known issue and I will solve it soon. I have to try an alternate method to get the timezone info. I will have some time to fix this by the next few days.