date

Can we have customized "Date Prompt" in cognos8?

Hi, I am working with Cognos8 Report Studio. In my report there are two date prompts, (1) START date, (2) END date. Users can select two different dates or two same dates. But the report has valid data only for last business date of each month. For example, if Jan 31 is Sunday, valid data is available only for Jan 29 which is Friday(las...

How do I use PHP to get the current year?

I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be out-of-date. How would I make the year update automatically with PHP4 and PHP5? ...

How to control the capitalization of month and day names returned by DateFormat?

Here is a quick test program: public static void main( String[] args ) { Date date = Calendar.getInstance().getTime(); System.out.println("Months:"); printDate( "MMMM", "en", date ); printDate( "MMMM", "es", date ); printDate( "MMMM", "fr", date ); printDate( "MMMM", "de", date ); System.out.println("Da...

Java: Date.getTime() not including time?

Can't understand why the following takes place: String date = "06-04-2007 07:05"; SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm"); Date myDate = fmt.parse(date); System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007 long timestamp = myDate.getTime(); System.out.println(timestamp); //1180955100000 -- where are the...

Relative date string in pseudocode

Looking for the best pseudo-code to generate a relative date string (ex. 'asked 1 minute ago', 'asked 2 days ago', 'asked 3 weeks ago', 'asked 4 months ago'...). Currently implementing this myself and thought it would be a good programming exercise for those that have not tried this before. Ryan Edit: I did search before posting and ...

Get Last Friday of Month in Java

I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Java, but I was wondering if anyone knew of anything more concise or efficient. Below is what I tested with for this year: for (int month = 0; month < 13; month++)...

Java JFormattedTextField for typing dates

Hi! I've been having trouble to make a JFormattedTextField to use dates with the format dd/MM/yyyy. Specifically, as the user types, the cursor should "jump" the slashes, and get directly to the next number position. Also, the JFormattedTextField must verify if the date entered is valid, and reject it somehow if the date is invalid, or...

Dealing with Date only dates across timezones in .Net

Ok - a bit of a mouthful. So the problem I have is this - I need to store a Date for expiry where only the date part is required and I don't want any timezone conversion. So for example if I have an expiry set to "08 March 2008" I want that value to be returned to any client - no matter what their timezone is. The problem with remoting ...

How to get date picture created in java

I would like to extract the date a jpg file was created. Java has the lastModified method for the File object, but appears to provide no support for extracting the created date from the file. I believe the information is stored within the file as the date I see when I hover the mouse pointer over the file in Win XP is different than wh...

Elapsed time without considering weekends and bank holidays in Java

I've implemented a stopwatch that works fine without considering that bank holidays and weekends shouldn't be counted in the total duration. I was looking for some open-source library where I could get the elapsed time, passing a start instant, end instant and a set of bank holidays (weekends aren't counted in). The only library that mak...

Non-iterative / Non-looping Way To Calculate Effective Date?

I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished manufacturing withou...

Need a free datepicker for ASPX

What is the best FREE Datepicker that can be dropped into an ASPX application? ...

How to get a table of dates between x and y in sql server 2005

I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark missing days with a 0 ...

How do I convert a date/time to epoch time (aka unix time -- seconds since 1970) in Perl?

Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT? Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array? ...

SQL Query Help: Selecting Rows That Appear A Certain Number Of Times

I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear < k number of times? ...

Storing a calendar day in sqlite database

I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what clock time should it be? Update: I am aware of ISO8601 and actually used it...

Get the time of tomorrow xx:xx

Dear all, what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them! Okami ...

php check for a valid date, weird date conversions

Is there a way to check to see if a date/time is valid you would think these would be easy to check: $date = '0000-00-00'; $time = '00:00:00'; $dateTime = $date . ' ' . $time; if(strtotime($dateTime)) { // why is this valid? } what really gets me is this: echo date('Y-m-d', strtotime($date)); results in: "1999-11-30", huh? i ...

What is the best way to parse a time into a Date object from user input in Javascript?

I am working on a form widget for users to enter a time of day into a text input (for a calendar application). Using JavaScript (we are using jQuery FWIW), I want to find the best way to parse the text that the user enters into a JavaScript Date() object so I can easily perform comparisons and other things on it. I tried the parse() met...

How do I parse a number from a String that may have a leading zero?

In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer constructor. date =~ /^([\d]{2})([\d]{2})([\d]{4})/ year = Integer($3) month = Integer($2) day = Int...