Re: File.mtime <=> DateTime.strptime()



On Fri, 9 Sep 2005, Hugh Sasse wrote:

On Fri, 9 Sep 2005, Ara.T.Howard wrote:

On Fri, 9 Sep 2005, Hugh Sasse wrote:

I'm trying to compare how new a file is with the header obtained
from Net::HTTP.head().  I use
[...]
But I can't compare this with the results of File.mtime, because one
is a DateTime, and one is a Time.  Time::strptime or Time::strftime

this might help...

 harp:~ > cat a.rb
 require 'alib'

What is alib?

ara's lib ;-) it's a holding place for all the utility methods i don't end up putting anywhere else. i also have inlined some small, but very useful code developed by other people like satoru takabayashi's bsearch code for built-in arrays. it's a mix of useful stuff like

  - Util : lot's of time/string/process/filesystem/tmpdir-file/hash
    manipulation routines

  - Main : utilities for whipping out simple and configurable (via yaml file)
    main programs that support usage, logging, command line and option parsing
    in seconds

  - Bsearch : bsearch support for arrays

  - OrderedHash : name says it all

basically it's my personal stash of stuff i can't live without.  get it here

  http://codeforpeople.com/lib/ruby/alib/


I think it depends on whenther I can get both times into the same form.

to form those methods use is iso-8601 - should be a peice of cake.

cheers.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================



.



Relevant Pages

  • Re: Dates
    ... Create SqlParameter objects for the parameters and add them to the Parameters collecion of the command. ... The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. ... System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +260 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Console application switches for argument values?
    ... On the DEBUG tab in the text box labeled "Command line arguments:" enter ... DateTime end = DateTime.Now; ... bool good = true; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Count Time hours, minutes, seconds
    ... you can use the DATETIME() function. ... command to stop the time then keep adding this time to a total time ... The idea is to add the time that a user types ... into the memo field in order to keep track of how long they are ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Insert Date
    ... To be on the safe side, you should use parametrised sql insert command. ... SqlCommand cmd = new SqlCommand("INSERT INTO Table (..., datecolumn) VALUES ... You should convert your date to DateTime type: ... > I have a column with data type datetime. ...
    (microsoft.public.dotnet.framework.adonet)

Loading