Ask a Question related to Ruby, Design and Development.
-
Ben Giddings #1
SMTP Date format?
Hey all,
Is there already code which formats a date into the format required for SMTP?
[url]http://ftp.rfc-editor.org/in-notes/rfc2822.txt[/url]
See sec 3.3
I've been writing my own version, but it really seems like it must have
already been done.
Ben
Ben Giddings Guest
-
Date format 07-JUL-03
What's the simplest format method to force the medium date format to capitalize the month, like 07-JUL-03 instead of 07-Jul-03 in a form text box?... -
Date Format in Com+
Hi All, I have one Component in VB6. My component receive a date as string parameter ("dd/MM/yyyy"). My componente understand "MM/dd/yyyy". Then I... -
Date() Format
Hi Im trying to get a mm/dd/ccyy format and can nearly do this using date() however I for 02 Feb 2004 I get 2/2/2004 and I want 02/02/2004 -
converting date into database date format(newbie)
Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?> -
Date format Help.
I have a field set to short date 99;99;00;0, and it appears as soon as I tab to the next couple of fields that the previous date field changes to... -
Tanaka Akira #2
Re: SMTP Date format?
In article <200307221635.02170.ben@thingmagic.com>,
Ben Giddings <ben@thingmagic.com> writes:
time.rb which is bundled since 1.6.7 has Time#rfc2822.> Is there already code which formats a date into the format required for SMTP?
>
> [url]http://ftp.rfc-editor.org/in-notes/rfc2822.txt[/url]
% ruby -rtime -e 'p Time.now.rfc2822'
"Wed, 23 Jul 2003 09:29:05 +0900"
--
Tanaka Akira
Tanaka Akira Guest
-
Ben Giddings #3
Re: SMTP Date format?
On Wed July 23 2003 9:35 am, Josef 'Jupp' Schugt wrote:
Well the tough part was going to be the timezone offset part:> * Ben Giddings; 2003-07-22, 20:38 UTC:>> > Is there already code which formats a date into the format required
> > for SMTP?
> What exactly can strftime not do for you?
Date: Wed, 23 Jul 2003 22:35:49 +0900
^^^^^
But now that I found the time library which does the formatting I'm set.
While we're on the subject though, what's the recommended method for
determining your timezone offset in Ruby?
Ben
Ben Giddings Guest
-
Brian Candler #4
Re: SMTP Date format?
On Thu, Jul 24, 2003 at 01:22:33AM +0900, Josef 'Jupp' Schugt wrote:
But Unix machines, although they "run" on UTC, can be configured with a> On Thu, 24 Jul 2003, Ben Giddings wrote:
>
>>> > But now that I found the time library which does the formatting I'm
> > set.
> >
> > While we're on the subject though, what's the recommended method
> > for determining your timezone offset in Ruby?
> On my system (at home) the only reliable method would be asking the
> user to provide it. The machine is running on UTC while the official
> timezone is MESZ (UTC+2).
local timezone. This is the time you will see when you run the 'date'
command, for example. On most machines I've seen this is set by creating
/etc/localtime as a symlink to /usr/share/zoneinfo/<whatever>; it can also
be overriden by setting environment variable TZ.
In many parts of the world the timezone offset varies throughout the year,
but with a modern implementation of localtime() it will tell you it:
#include <stdio.h>
#include <time.h>
int main(void)
{
time_t now = time(NULL);
struct tm *tm = localtime(&now);
printf("The current timezone name is %s\n",tm->tm_zone);
printf("The current timezone offset is %ld secs from GMT\n",tm->tm_gmtoff);
return 0;
}
When I run this I get:
The current timezone name is BST
The current timezone offset is 3600 secs from GMT
(I am in the UK). So the information is there - whether there's a Ruby
wrapper for it I don't know.
If you're on a Windows machine though, you're in a whole different sorry
state. At work I get E-mails from people using Outlook calendar saying
"meeting scheduled for 14:00 GMT (London, Lisbon, ...)" when in fact they
mean 2pm local time, which in the summer is 13:00 GMT. The clock is actually
moved forwards and backwards when daylight savings starts and ends, instead
of calculating the offset. If you turn your computer on at 1.30am on the day
that the change takes place, your computer has no idea what the correct time
is.
Cheers,
Brian.
Brian Candler Guest
-
Josef 'Jupp' Schugt #5
Re: SMTP Date format?
Saluton!
* Brian Candler; 2003-07-24, 12:25 UTC:UTC, no offset here. Principle of least trouble.> When I run this I get:
>
> The current timezone name is BST
> The current timezone offset is 3600 secs from GMT
Gis,
Josef 'Jupp' Schugt
--
N'attribuez jamais à la malice ce que l'incompétence explique !
-- Napoléon
Josef 'Jupp' Schugt Guest
-
Brian Candler #6
Re: SMTP Date format?
On Fri, Jul 25, 2003 at 04:14:25AM +0900, Trevor Jenkins wrote:
Well, each to his own. If you're parsing crappy log files that don't store> I don't believe in BST so there's no surprise that all my systems here, in
> London, report:
>
> The current timezone name is GMT
> The current timezone offset is 0 secs from GMT
>
> Which is as it should be.
the time unambiguously, then I agree that local time could be a problem.
Cheers,
Brian.
Brian Candler Guest
-
Ian M Dew #7
Re: SMTP Date format?
Thank you, Tanaka Akira!
With non-rfc2822 date formats, the Android email app displays dates as "12/31/1969" and places emails at the bottom of the inbox.Ian M Dew Guest



Reply With Quote

