Ask a Question related to Ruby, Design and Development.
-
Dennis Oelkers #1
Concerting a Date Object into a UNIX Timestamp
Hello beloved Ruby-Community,
maybe a stupid question because I probably missed something reading the
reference of "Programming Ruby", but how do I convert a Date Object into
a UNIX Timestamp (seconds passed since the UNIX epoch)?
Kind regards,
Dennis Oelkers
--
Dennis Oelkers | Webadministration | Zentraleinrichtung Rechenzentrum
TU-Berlin | EN-Gebaeude, K042 | Telefon: 030-314-25029
Key Fingerprint:
A6 7A B6 90 09 56 E8 32 02 40 6B 27 80 17 00 89 61 E7 CA 6F
Dennis Oelkers Guest
-
#40116 [NEW]: using gregorian to jeulian to unix timestamp in date is wonky
From: marsh dot wayne at gmail dot com Operating system: Windows 2000 SP4 PHP version: 5.2.0 PHP Bug Type: Calendar related... -
#39245 [NEW]: date function generate wrong date with 1162083600 timestamp
From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ... -
int4 -> unix timestamp -> sql timestamp; abstime?
Hello, what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as... -
Date comparisons using UNIX timestamp?
Hi all, How does one compare dates if one (or both) of the dates is before 1/1/1970? I tried converting the user's input (from selection boxes;... -
convert UNIX timestamp
Hi Scott, All How can I reverse this ? ( Convert date/time format to UNIX timestamp ) Thanks! Jason. Hall, Scott wrote: -
Simon Strandgaard #2
Re: Concerting a Date Object into a UNIX Timestamp
On Wed, 19 Nov 2003 17:15:08 +0100, Dennis Oelkers wrote:
irb(main):001:0> Time.now.to_i> maybe a stupid question because I probably missed something reading the
> reference of "Programming Ruby", but how do I convert a Date Object into
> a UNIX Timestamp (seconds passed since the UNIX epoch)?
=> 1069258948
irb(main):002:0>
--
Simon Strandgaard
Simon Strandgaard Guest
-
Dennis Oelkers #3
Re: Concerting a Date Object into a UNIX Timestamp
In [email]pan.2003.11.19.16.23.18.103013@sneakemail.com[/email] Simon Strandgaard <qj5nd7l02@sneakemail.com> wrote:
Ah, thank you very much for that helpful (and quick!) response,> On Wed, 19 Nov 2003 17:15:08 +0100, Dennis Oelkers wrote:>> > maybe a stupid question because I probably missed something reading the
> > reference of "Programming Ruby", but how do I convert a Date Object into
> > a UNIX Timestamp (seconds passed since the UNIX epoch)?
> irb(main):001:0> Time.now.to_i
> => 1069258948
> irb(main):002:0>
in fact I tried the to_i method, but on a Date object (doh!).
irb(main):002:0> Date.new(2003, 11, 19).to_i
NoMethodError: undefined method `to_i' for #<Date: 4905925/2,0,2299161>
from (irb):2
irb(main):003:0>
Kind regards,
Dennis Oelkers
--
Dennis Oelkers | Webadministration | Zentraleinrichtung Rechenzentrum
TU-Berlin | EN-Gebaeude, K042 | Telefon: 030-314-25029
Key Fingerprint:
A6 7A B6 90 09 56 E8 32 02 40 6B 27 80 17 00 89 61 E7 CA 6F
Dennis Oelkers Guest



Reply With Quote

