search for: parsedate

Displaying 20 results from an estimated 32 matches for "parsedate".

Did you mean: parsedata
2006 May 21
3
Using ParseDate in for loop
Hi, I''m trying to use ParseDate within a for loop but I get this error: can''t dup NilClass Any suggestions for making this work? Thanks, -Jason
2006 Jun 05
3
How to get dd mmm and yyyy from dd-mmm-yyyy
The input values could be something like this: 01-Dec-2006 01-December-2006 1-June-2006 Is there an easy to way to get the three variables populated dd, mmm and yyyy for any of the above input values? I tried to look at regex but couldn'' anything simple. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Jan 28
1
Method for returning a random date between two dates
Hi, I''m trying to create a method to return a random date within a range. So far, I''ve come up with this... require ''parsedate'' def random_date (a, b) adate = ParseDate.parsedate(a) bdate = ParseDate.parsedate(b) atime = Time.local(*adate) btime = Time.local(*bdate) atime + (rand * (atime - btime) ) end ...and it doesn''t seem to work--the dates returned aren''t within the given...
2005 Sep 06
1
US Date Handling in Rails
My application is built on Rails and MySQL. It will only be accepting US formatted dates as input, however both Rails and MySQL are oriented around ISO the format. I know I can convert a good portion of the entries using ParseDate::parsedate but it does not appear this is how the conversion is taking place when data is being transferred from the params hash into model members. Say I have a field ''sold_on'' of type DATE in the database. Would the following model code be along the right lines? require '&...
2006 Jun 15
4
parse only seem to understand US date format
I''ve tried Time.parse() and DateTime.parse() but they interpret the date as US format. Is there any way to tell it to interpret as dd/mm/yyyy? -- Posted via http://www.ruby-forum.com/.
2009 Dec 08
0
Holiday Gift Perl Script for US Holiday Dummy Regressors
...t;end|e=s" => \$end, "scope|c=s" => \$scope, "file|f=s" => \$filename); print "Generating Holiday Dummy Variables starting $start to $end generated by $scope. Output to $filename \n"; #print all the dates based on scope as a test $startDate=ParseDate(\$start); if (! $startDate) { print "Error in the date";exit; } $endDate= ParseDate($end); print "Start Date: ",UnixDate($startDate,"%m/%d/%Y"),"\n"; print "End Date: ",$end,"\n"; print "Last Day in Month: ",UnixDate(ParseDa...
2009 Dec 08
0
Opps Correct Version of Holiday Regressor Perl Script
..." => \$scope, "file|f=s" => \$filename); open (OUTFILE, ">>$filename"); print "Generating Holiday Dummy Variables starting $start to $end generated by $scope. Output to $filename \n"; #print all the dates based on scope as a test $startDate=ParseDate(\$start); if (! $startDate) { print "Error in the date";exit; } $endDate= ParseDate($end); print OUTFILE "Start Date: ",UnixDate($startDate,"%m/%d/%Y"),"\n"; print OUTFILE "End Date: ",$end,"\n"; # print OUTFILE "Last Day in Mont...
2006 Jul 17
2
european date format
hi, overhere users go nuts if they have to enter the date in iso format, so i have to make my applications in such a way that not only dates are displayed in the "dd-mm-yyy" format but also can be entered in that way. somewhere i found this code to put in the environment script: ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y
2006 May 11
4
string to date/time?
Hey All, Anyone know of a library for parsing "human" dates, like "this friday" or "2 days ago"? I used to use strtotime in php, but starting from here; http://wiki.rubyonrails.com/rails/pages/PhpStrtotime and doing lots of googling, I haven''t been able to find anything similar for ruby. I know of javascript solutions to this, but I''d need to do
2006 May 13
1
undefined method `strftime'', being called from a partial.
Hi, I''m having an issue with calling a function that I''ve defined in ApplicationHelper called format_time: module ApplicationHelper def format_time(time) time.strftime("%a %b %d, %I:%M%p") end end I use this function in my views to format the Time.now that I would have stored in my tables as a DATETIME. I''m able to use this function, without any
2006 Jan 16
3
String date parsing
...yone know if a Ruby package has been written to handle functionality similar to php''s strtotime(). I''m looking for something that can parse almost any string (such as "1 day ago", "+1 week", "last tuesday") into a timestamp. I''ve played with ParseDate, but it doesn''t seem to do what I need. Any suggestions? Derek
2006 Jan 20
1
Time From String
Is there any Ruby / Rails way to take a string and convert it to time? timefstr Specificallc,y I''d like to convert iso 8601 fromats to Ruby Time objects or ActiveRecord time fields. -- Posted via http://www.ruby-forum.com/.
2006 Jul 26
8
change text_field_tag class
...=> "readonly", :maxlength => "25"} ) %> </div> ---------- the observe_field detects a new startdate selection from the calendar handled by startdateChanged action (calculating an endingdate 10 days after) in the booking_controller def startdateChanged pd = ParseDate::parsedate(@params["input"]) tl = Time.local(pd[0], pd[1], pd[2]) @enddate = (tl+(84600*10)).strftime("%d/%m/%Y") render :update do | page | page[''enddate''].value = @enddate @enddateclass = "format-d-m-y range-low-" + (tl...
2019 Oct 16
2
BackupPC v4 from epel
...conflicting requests - nothing provides par2cmdline needed by BackupPC-4.3.1-2.el8.x86_64 - nothing provides perl(Net::FTP::AutoReconnect) needed by BackupPC-4.3.1-2.el8.x86_64 - nothing provides perl(Net::FTP::RetrHandle) needed by BackupPC-4.3.1-2.el8.x86_64 - nothing provides perl(Time::ParseDate) needed by BackupPC-4.3.1-2.el8.x86_64 - nothing provides perl(XML::RSS) needed by BackupPC-4.3.1-2.el8.x86_64 - nothing provides perl-Time-modules needed by BackupPC-4.3.1-2.el8.x86_64 (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best...
2006 Jul 26
0
render :update do | page | to modify a css class string...
...also modify the css clas that will toggle some dates in the calendar ( a format with rangelow..) but I don''t know how to modify the css class string of the ending date the value is correctly set, not the css class when rendering the page.... def startdateChanged pd = ParseDate::parsedate(@params["input"]) tl = Time.local(pd[0], pd[1], pd[2]) @enddate = (tl+(84600*10)).strftime("%d/%m/%Y") render :update do | page | page[''enddate''].value = @enddate @enddateclass = "format-d-m-y range-low-" +...
2006 Jun 21
0
SQLServer Timestamp parsing problem in sqlserver_adapter.rb
...a datetime format. So, when I try to read or write to the field, it gives me a parsing error: NoMethodError: private method ''gsub!'' called for [0, 0, 0, 0, 0, 0, 224, 43]:Array from c:/ruby/lib/ruby/1.8/date/format.rb:253:in ''_parse'' from c:/ruby/lib/ruby/1.8/parsedate.rb:9:in ''parsedate'' from c:/ruby/lib/ruby/1.8/gems/activerecord-1.14.2/lib/active_record_cnnection_adapters/sqlserver_adapter.rb:92:in ''cast_to_time'' from c:/ruby/lib/ruby/1.8/gems/activerecord-1.14.2/lib/active_record_cnnection_adapters/sqlserver_adapter.rb:82...
2006 Jun 23
0
Multiparameter error
...This is from the wiki require ''date'' # It''s necessary to do this, because Time doesn''t # support dates before 1970... class ActiveRecord::ConnectionAdapters::Column def self.string_to_time(string) return string unless string.is_a?(String) time_array = ParseDate.parsedate(string)[0..5] begin Time.send(Base.default_timezone, *time_array) rescue DateTime.new(*time_array) rescue nil end end end Any help would be appreciated Jeff -- Posted via http://www.ruby-forum.com/.
2006 Mar 01
3
Convert Date to Time
Hi, How do i convert a Date to a Time?? I have a date returned from sql and i need to be able to use handy functions like next_week or beggining of week. Any help appreciated Thanks, Chris -- Posted via http://www.ruby-forum.com/.
2005 Feb 19
0
[Error] Using validates_presence_of for datetime field causes parse error?
...e end When I run this unit test, I get: 1) Error: test_create(StudentSurveyTest): NoMethodError: private method `gsub!'' called for #<DateTime: 11776418931730081/4800000000,-5/24,2299161> /usr/lib/ruby/1.8/date/format.rb:238:in `_parse'' /usr/lib/ruby/1.8/parsedate.rb:9:in `parsedate'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/ connection_adapters/abstract_adapter.rb:228:in `string_to_time'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/ connection_adapters/abstract_adapter.rb:196:in `t...
2006 May 16
4
question about strftime when called from partial.
Hi, I''m calling a helper I''ve written - format_time() that is called from my views with a given time that was selected from my database and was returned to the view via an instance variable. When I call format_time from a partial, I see that I get some kind of String error and the partial won''t render. Basically, the object being passed in to format_time is already a