Hi Dirk,

but I don't have a POSIXct object, I have an xts time series object and want
the timestamps as seconds/milliseconds with the goal to save it to a
database ...


Thanks,
Ulrich



On Sun, Jun 5, 2011 at 7:57 PM, Dirk Eddelbuettel <edd@debian.org> wrote:

>
> On 5 June 2011 at 19:41, Ulrich Staudinger wrote:
> | Misunderstanding ...
> |
> | rowse[1]> options(digits.secs=6)
> | Browse[1]> head(tempBs)
> |                         ..1   ..2 ..3 pnlSlice
> | 2011-06-03 13:32:24.975 242 99125   1      -75
> | 2011-06-03 13:32:55.036 242 99100  -1      -25
> | 2011-06-03 13:36:10.490 242 98850  -1      -50
> | 2011-06-03 13:36:59.064 242 98775   2       25
> | 2011-06-03 13:38:21.795 242 98550  -2     -200
> | 2011-06-03 13:40:01.725 242 98825   1     -450
> | Browse[1]>
> |
> |
> | that's not what I need. A bit of digging revealed:
> |
> | Browse[1]> as.double(as.POSIXct("2011-06-03 13:32:24"))
> | [1] 1307100744
> | Browse[1]>
> |
> | I would like to get the timestamp instead of a date string ...
> | some matrix where the first column contains the timestamp in milliseconds
> | since epoch start ...
>
> Just use as.numeric() on your POSIXct object:
>
> R> print( as.numeric( Sys.time() ), digits=20 )
> [1] 1307296635.9376249313
> R>
>
>
> Dirk
>
> --
> Gauss once played himself in a zero-sum game and won $50.
>                      -- #11 at http://www.gaussfacts.com
>



-- 
Ulrich Staudinger <https://www.xing.com/profile/Ulrich_Staudinger>
http://www.activequant.org

	[[alternative HTML version deleted]]

