These code is to read the email i save in the text file that i have
retrieved from gmail.
msisdn = “”
datetime = “”
date = “”
File.open(Pathname.new(ARGV[0]), ‘r’) do |mbox|
RMail::Mailbox.parse_mbox(mbox) do |raw|
count += 1
print “Mail #{count}\n”
message = RMail::Parser.read(raw)
msisdn = message.header['From']
datetime = message.header['Date']
When i do
date = DateTime.parse(datetime)
the result is 2008-06-05T08:45:58+00:00
But i only want the format to be 2008-06-05 08:45:58 because only these
match the mysql datetime format. Is there other way of do the parsing?
Thanks
Wawa