date

XSD and Date Range Validation

How would I write the XSD to validate the StartDate element and EndDate element are within the Quarter element and Year element? Thanks. <OrganizationName>Chevron</OrganizationName> <Quarter>4</Quarter> <Year>2010</Year> <Fuel> <FuelPathwayCode>CARBOBCB001</FuelPathwayCode> <PhysicalPathwayCode>PP001</PhysicalPathwayCode> <transacti...

How can I make SimpleDateFormat.parse() fail when month is greater than 12?

I'm using java.text.SimpleDateFormat to parse strings of the form "yyyyMMdd". If I try to parse a string with a month greater than 12, instead of failing, it rolls over to the next year. Full runnable repro: import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class ParseDateTest { pub...

jQuery UI, Calendar, find out if date given is over 2 years old

Hay Guys, I'm using the bog standard Calendar from the jQuery UI system. The result shown (after a user clicks a date) is MM/DD/YYYY. I want to check that this date is not old than 2 years old ie say a user picks 01/27/2004 this should say that the date is older than 2 years. However, 12/25/2008 should pass the test. any ideas...

Java Date cut off time information

Hi Folks, I have a Java Date object containing date and time information, e.g. 2008-01-01 13:15:00. I want to write a method that cuts off the time information so I only have the date left, e.g. 2008-01-01 00:00:00. Do you have a tip? I tried doing something like this (timestamp / (24 * 60 * 60 * 1000)) * (24 * 60 * 60 * 1000) but I ...

Init javascript Date object

Hi, I would like to retrieve a Javascript object Date for new year. I want to user new Date(); object and init it to the 2009-01-01 (it's for a countdown). Thanks ...

Problem with regional settings date

Hi Guys, I got a problem with the date settings on my client system, My program demands to set the date as DD/MM/YYYY and I used the type as text in the database, so I am unable to see what was the date format in my client computers regional settings so if my client computers regional setting is MM/DD/YYYY if while checking the date ...

Is there a Perl equivalent of SAS' INTNX function or Javascript's Dateadd function?

I'm trying to convert Chinese lunar system to Gregorian using Perl, both for fun and for learning purposes. I thought there was some kind of easy mathematical algorithm to do the job but turned out I was wrong. Anyway, after a little googling around I came aross some ready SAS code that could do the job. Well, it was not too difficult fo...

PHP Echo Timezone based on GMT offset

I have an application that stores GMT time data in a MySQL db like this: 2009-12-16 15:27:47. The user's timezone offset is stored in another column like this: -6 The above timezone is GMT-6, which is CST. Is there any way I can echo CST (i.e. - date('T")) from the GMT offset data? Note: I should also add that the application global t...

Sharepoint Designer - is there a way to calculate a date difference in a workflow?

Maybe I'm just crazy... So, with SPD I can add any time unit to a date and put that into a variable, but I can't seem to find anything that will let me calculate the difference between two dates. "Do Calculation" only lets me pick from numeric values. Am I missing something here? Seems like something which should be obvious. ...

Determine if a year is leap and if a date is valid in Blackberry

i get a date input from the user..in this case i need to determine if the year the user entered is a leap year or not ...and after the user has entered the entire date i.e the month date and year...i need to check if the date is in fact valid if yes need to determine the day for that particular date.. can some one tell me how this could ...

Formatting Date on Java

Hi there. I have a String with the following format: january_2005 (MMMMMMM_yyyy) and i want to convert it to a mysql acceptable date value to insert it on the database. I need to do it on Java. Does anyone knows how to do it? Thanks ...

How many problems are in the following date parsing routines that come from a real-world project?

These methods are laughably stupid, IMO, but I want to get a feel for what other developers think of such code. Criticisms may include technical and stylistic errors. Corrections may use anything from Apache commons-lang, such as StringUtils, DateUtils, etc, as well as anything in Java 5. The code is intended for a web application, if th...

How to parse Date from HTTP Last-Modified header?

HTTP Last-Modified header contains date in following format (example): Wed, 09 Apr 2008 23:55:38 GMT What is the easiest way to parse java.util.Date from this string? ...

MySQL: Who are today "on" between 2 diferent dates

I have a Mysql problem. (I use PHP with it). For example I have this kind of database: Name | Started and | will end Jason | 2009-12-17 | 2009-12-24 Ericke | 2009-12-12 | 2009-12-30 Maria | 2010-01-02 | 2010-01-10 With mysql (or php) question I would like to get the names of people, which are "on" right now (2009-12-19). The answer...

Connecting nodes to multiple dates

I have company website, with many offices around the world (around 50 offices). The company want to create a gift giveaway with the employees in a specific company each specific day. For example: Office 1: will do the giveaway the days: 1/1/2010, 7/1/2010, 15/1/2010, etc... Office 2: the days: 2/1/2010, 9/1/2010, 19/1/2010, etc... Offi...

how to test date and datetime with mysql

hi guys, My table is using a datetime (YYYY-MM-DD HH:MM:SS) and i need to display today's entries. my code is only : SELECT * FROM table WHERE date = '$date' ORDER BY score DESC with $date = date("Y-m-d"); well, as expected it doesnt work :| you guys have a solution here ? ...

Convert date to datetime in Python

Silly question, but is there a built-in method for converting a date to a datetime in Python, ie. getting the datetime for the midnight of the date? The opposite conversion is easy - datetime has a .date() method. Do I really have to manually call datetime(d.year, d.month, d.day) ? Edit: and the winner is: datetime.combine(d, time()) ...

Date Difference in php?

Is there a quick way to calculate date difference in php? For example: $date1 = '2009-11-12 12:09:08'; $date2 = '2009-12-01 08:20:11'; And then do a calculation, $date2 minus $date1 I read php.net documentation, but no luck. Is there a quick way to do it? EDIT: I will put up the whole answer (for some people who might curious of ho...

compare date/time via VBA with date/time in Access DB

Hi, How to compare a date/time via VBA with a date/time in an Access DB? The query I use adoRS.Open "SELECT * FROM currentpositions WHERE ((currentpositions. [dateLT])=" & "#" & date_from_message & "#" & ")", adoConn, adOpenStatic, adLockOptimistic I only achieve to compare a date. Anybody an idea? Regards Camastanta ...

using BC dates in Drupal date field

Hi I am trying to input BC dates in Drupal 6.15 using the Date module. If I enter "old" dates (less than 1000 AD) I get an error. How can I go about this? I cannot revert to text because I need to order things by their date. I need to be able to input really ancient dates like 300 BC. The date is the most important data point in this pa...