No problem. We'll get the functionality fully fleshed out at some point,
but until then, it's nice when the functionality is already in our workflow.

-Jacob


On Tue, May 6, 2014 at 9:53 PM, Dan B <[email protected]> wrote:

> Jacob,
>
> Thank you so much... for the fast reply and great suggestion!  Doing this
> achieved exactly what I needed:
>
> julia> results = query("SELECT to_char(created,'YYYY-MM-DD HH:MI:SS') from
> auditrecord order by created desc limit 10")
>
> elapsed time: 4.2695e-5 seconds
>
> 10x1 DataFrame
>
> |-------|-----------------------|
>
> | Row # | to_char               |
>
> | 1     | "2014-05-05 11:59:58" |
>
> | 2     | "2014-05-05 11:59:57" |
>
> | 3     | "2014-05-05 11:59:56" |
>
> | 4     | "2014-05-05 11:59:56" |
>
> | 5     | "2014-05-05 11:59:55" |
>
> | 6     | "2014-05-05 11:59:55" |
>
> | 7     | "2014-05-05 11:59:54" |
>
> | 8     | "2014-05-05 11:59:53" |
>
> | 9     | "2014-05-05 11:59:53" |
>
> | 10    | "2014-05-05 11:59:52" |
>
>
> On Tuesday, May 6, 2014 6:38:33 PM UTC-7, Jacob Quinn wrote:
>
>> There's actually not much support in Datetime.jl for formatting/parsing
>> DateTimes (just regular Dates). (A rewrite of the package is nearing
>> completion as Dates.jl with much more solid support for formatting/parsing).
>>
>> In this case, I would suggest leveraging Postgres own formatting tools:
>> http://www.postgresql.org/docs/8.2/static/functions-formatting.html
>>
>> Cheers,
>>
>> -Jacob
>>
>>
>> On Tue, May 6, 2014 at 9:35 PM, Dan B <[email protected]> wrote:
>>
>>> Im new to using Julia - thanks in advance for the help.
>>>
>>> The short story is that Im using ODBC and DataFrames to return query
>>> results from a Postgres database, and Julia is changing the format of my
>>> timestamps from the database, I think because it's automatically setting
>>> them as DateTime types.  Im not sure how to prevent this from happening, or
>>> change the format that it's automatically setting after the result is set.
>>>
>>> In the database, they are Postgres timestamp types and they look like
>>> this: *2014-04-24 10:37:10 *
>>> In Julia they look like this when set in the DataFrame:  
>>> *2014-04-25T09:08:10
>>> UTC *- Notice the extra T in the middle, and the timezone on the end.
>>>
>>> Example:
>>>
>>>
>>> julia> results = query("SELECT created FROM auditrecord LIMIT 10")
>>>
>>>
>>> elapsed time: 6.7873e-5 seconds
>>>
>>>
>>> 10x1 DataFrame
>>>
>>> |-------|-------------------------|
>>>
>>> | Row # | created                 |
>>>
>>> | 1     | 2010-11-29T17:21:06 UTC |
>>>
>>> | 2     | 2010-11-29T17:22:46 UTC |
>>>
>>> | 3     | 2010-11-29T17:26:08 UTC |
>>>
>>> | 4     | 2010-11-29T17:34:55 UTC |
>>>
>>> | 5     | 2010-11-29T17:36:16 UTC |
>>>
>>> | 6     | 2010-11-29T17:36:18 UTC |
>>>
>>> | 7     | 2010-11-29T17:38:40 UTC |
>>>
>>> | 8     | 2010-11-29T17:39:40 UTC |
>>>
>>> | 9     | 2010-11-29T17:41:19 UTC |
>>>
>>> | 10    | 2010-11-29T17:43:34 UTC |
>>>
>>>
>>> julia> eltype(results[1])
>>>
>>> DateTime{ISOCalendar,Zone0}
>>>
>>>
>>> I looked at the documentation for DateTime, and I see that I can change
>>> formats, but Im not sure how to apply a format string to the array column.
>>>  (kinda wouldn't expect the following to magically change the formatting of
>>> a whole array column but it's what I want to do)  Im sure it's a newbie
>>> mistake with a simple answer.  Thanks for the help :)
>>>
>>> julia> f = "yyyy-MM-dd HH:mm:ss"
>>>
>>> "yyyy-MM-dd HH:mm:ss"
>>>
>>>
>>> julia> datetime(f,results[1])
>>>
>>> ERROR: no method datetime(ASCIIString, DataArray{DateTime{
>>> ISOCalendar,Zone0},1})
>>>
>>
>>

Reply via email to