date

Why does Date::Calc complain about "not a valid date"?

Previously, this function worked for me... $this_day = Day_of_Week($lyear, $month, $day); using this lib.. use Date::Calc qw(Add_Delta_Days Day_of_Week Delta_Days); But I need another way to get this same info. the error it returned is Date::Calc::Day_of_Week(): not a valid date Any ideas? ...

How do I format dates in Perl?

I'm modifying a pre-existing script in Xcode to customize my file headers. The script is Perl and it's not my best langage. :) I just need to insert the current date in the header in dd/mm/yy format. Here is my script : #! /usr/bin/perl -w # Insert HeaderDoc comment for a header # # Inserts a template HeaderDoc comment for the header....

Why does date parsing depend on separators?

Take the two following examples: Date.parse("02/20/2009") Date.parse("02-20-2009") In the first example, the order is assumed to be MM DD YYYY, but in the second example an error is raised because (I'm assuming) it tries to parse it as DD MM YYYY. Why? ...

Shell script datetime function?

I am running the following script: #!/bin/ksh ./clear_old ./rooms_xls.pl 2/23/09 cd doors ./doors_xls.pl 2/23/09 How can I get the date to be today's date based upon the system/server time? ...

Default value to a data parameter , SSRS

In my SSRS report I wanted to default the date parameter with the execution date. I default the date patameter with =DateValue(Globals!ExecutionTime) or =today. I do have 5 other parameters in my report. In reporting manager, it makes the page refresh each time when I select another parameter value. Why is that? How do I solve this? ...

Should I use Java date and time classes or go with a 3rd party library like Joda Time?

Hi, I'm creating a web based system which will be used in countries from all over the world. One type of data which must be stored is dates and times. What are the pros and cons of using the Java date and time classes compared to 3rd party libraries such as Joda time? I guess these third party libraries exist for a good reason, but I'v...

Get the previous month's first and last day dates in c#

I can't think of an easy one or two liner that would get the previous months first day and last day. I am LINQ-ifying a survey web app, and they squeezed a new requirement in. The survey must include all of the service requests for the previous month. So if it is April 15th, I need all of Marches request ids. var RequestIds = (from r...

How do I include empty rows in a single GROUP BY DAY(date_field) SQL query?

I'm using MS SQL Server but welcome comparitive solutions from other databases. This is the basic form of my query. It returns the number of calls per day from the 'incidentsm1' table: SELECT COUNT(*) AS "Calls", MAX(open_time), open_day FROM ( SELECT incident_id, opened_by, open_time - (9.0/24) AS open_time, DATEPART(dd...

How do I validate a date in rails?

I want to be able to validate a date in my model in ruby on rails. However, the day, month and year values are already converted into an incorrect date by the time they reach my model. For example, if I enter February 31st 2009 in my view, when I do Model.new(params[:model]) in my controller, it converts it to March 3rd 2009. Which my m...

How to validate a MYSQL Date in PHP?

Users would select their date from 3 dropdowns (day, month, year). I will combine them on server-side to make a string like '2008-12-30'. How can I then validate to make sure this date was in the right format/numeric only, etc? ...

What is the first/last week of a month?

If someone were to say something happens in the first or last week of some month, how would you define that span? Background I'm working on a library that needs to handle this kind of thing in an intuitive way, but my intuition doesn't claim one case or the other. I can make it select different behavior but still need a good default...

sybase sql way of converting seconds value to hours minutes and seconds

In sybase is there any built in functions to convert a seconds value into hours, minutes, and seconds? ...

What's the best way to compare the equality of two DateTime's in C#... but only to a certain precision?

I have two datetimes, one from a timestamp, and another I'm generating in code. I need to test their equality, and would love to do it without too many expressions. Here's an example of my two dates: DateTime expireTimeStampUTC = DateTime.Parse(UTCValueFromDatabase)); DateTime expectedExpireTime = DateTime.UtcNow.AddHours(Nu...

SQL Date pattern for dates that user may not know all the information

You system allows new users to register and enter their wedding date. Being a purist, I wanted to store this as a date. After user interviews, it was clear that the reality differs from this approach. Users are often not sure of the day or the month, and wish to store partial dates, so "June 2009" or "sometime in 2012". Does anyone know...

Tool/library for calculating intervals like "last thursday of the month"

I'm looking for a command line tool or some sort of python library (that I can then wrap), so that I can calculate dates that are specified like "last thursday of the month". i.e. I want to let people enter human friendly text like that above and it should be able to calculate all the dates for any month/year/whatever that fulfil that. ...

What's a better way to sort by day date?

I have an Array of Events and I want to divide them into a 2-dimensional Array based on event_date (which returns a Time object). But I want it to be by the day part of the date. Here's what I have so far: def divide_events_by_day(events) # Sort, so we can start with the first day. events = events.sort { |x,y| x.event_date <=> y.eve...

VB.NET: Compare just the date part and not the time of two Dates

Hi, I want to compare just the date part (and Not the time) of two VB.NET Date objects. Is there a way to do that? Hoping to get some answers. /Ylva ...

Building up a monthly total from past 12 months

CurrentMonth = Month(CurrentDate) CurrentYear = Year(CurrentDate) SQL = "SELECT Spent, MONTH(Date) AS InvMonth, YEAR(Date) As InvYear FROM Invoices WHERE YEAR(Date) = '" & CurrentYear & "' AND MONTH(Date) = '" & CurrentMonth & "'" RecordSet.Open SQL, Connection, adOpenStatic, adLockOptimistic, adCmdText Do Until RecordSet.EO...

Simulating "faster time" in linux

I have a Java app that runs on linux that has a lots of events and business logic that revolve around times and dates. For testing, is it possible to tweak something into time going faster. Let's say, make a whole computer-year finish in one hour wall time? ...

date+time picker for jsf

Is there any ready-to-use component for JSF that allows to chose the Date + the Time of an event? All components I know only allow for date. adding time manually is tedious. ...