date

Please assist in explaining this asp.net error message when converting string to datetime

Function: Public Shared Function ConvertoDate(ByVal dateString As String, ByRef result As DateTime) As Boolean Try Dim supportedFormats() As String = New String() {"MM/dd/yyyy"} result = DateTime.ParseExact(dateString, supportedFormats, System.Globalization.CultureInfo.CurrentCulture, System.Globalization...

convert String to DateTime

I need to parse following String into a DateTime Object: 30/Nov/2009:16:29:30 +0100 Is there an easy way to do this? ...

Converting ISO8601-compliant String to java.util.Date

solved, see answer below Hi, I am trying to convert an ISO8601 formatted String to a java.util.Date. I found the pattern "yyyy-MM-dd'T'HH:mm:ssZ" to be ISO8601-compliant if used with a Locale (compare sample). However, using the java.text.SimpleDateFormat, I cannot convert the correctly formatted String "2010-01-01T12:00:00+01:00". I h...

php question... how to check if something is between two values?

I know I'm missing something easy here... I've been trying different operators, but haven't been able to figure this out... How do I go about checking to see if the current date is between two other dates? So, if I have a from date of 2/2/2010 and a to date of 2/10/2010, how can I return TRUE if the current date (2/4/2010) falls betwe...

Getting rails to accept European date format (dd/mm/yyyy)

Hi, I want my rails app to accept dates for a date field in the format dd/mm/yyyy. In my model I have tried to convert the date to the American standard which I think the Date.parse method that Rails will call on it is expecting: before_validation :check_due_at_format def check_due_at_format self.due_at = Date.strptime(self....

Writing a batch file for date-based file copying

I need to make a batch file that can copy files from one path to another based on parameters. For example, typing "datecopy -m 8 c:/copyfrom/*.* d:/copyto/*.*", would find all files in c:/copyfrom dated less than 8 months old, and copy them to d:/copyto -folder. Alternately, instead of -m for month, I could use -h for hour or -y for yea...

Inserting the current year into a TextView

Hi everyone, Just a small problem really, I'm wanting to place the current year into the footer of my apps. Each footer is a TextView and is seen on menu screens etc. Is there a way to insert the year into this dynamically? Cheers, Laurence ...

How can I validate a date in Python 3.x?

I would like to have the user input a date, something like: date = input('Date (m/dd/yyyy): ') and then make sure that the input is a valid date. I don't really care that much about the date format. Thanks for any input. ...

PHP - preg_match?

I'm not very good with expressions... I've looked at some online tutorials, but I'm still not getting it. Basically, I'm trying to return TRUE if a string is formatted like this: 4 digits + space + 2 digits and convert it to a date. So, the string will look like: 2010 02, and I'm trying to output February, 2010. I'm trying to use p...

Display image based on date in PHP

Somewhere on my computer I had a PHP script for displaying an image based on the date, that would allow me to display different images on specific dates, or between selected dates, and display a default date if the current date wasn't one listed with a specific image to display. I recently had a problem with one of my hard drives though...

Age from birthdate in python

How can I find an age in python from today's date and a persons birthdate? The birthdate is a from a DateField in a Django model. ...

comparing todays date + 30 days to another date

I'm trying an example: DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); String date = "03/09/2010"; //30 days from today Date usefullDate = df.parse(date); Calendar todaysDatePlus30Days = Calendar.getInstance(); todaysDatePlus30Days.add(Calendar.DAY_OF_YEAR, 30); System.out.println ("Compared Value: " + usefullDate.compareTo(todays...

SQLite Update date sql

SQLite Newbie I am trying to update a table with a date. Something like this: Update MyTable Set MyCol=GetDate() What is the correct syntax? ...

What are good reasons to choose TIMESTAMP over DATETIME columns in MySQL?

Disclaimer: This might be a duplicate of datetime vs. timestamp?, but I feel I am not convinced of the answers: My question is: What are the good reasons to choose TIMESTAMP over DATETIME columns in MySQL? I'm pretty sure I don't know everything there is about the differences between those two, so I will try to list the main advantages...

sql query date time

i have a datestamp field in my table structure. using sql, i want to find any user who registered in yesterdays date using these time range. eg: 2010-02-06 14:00:00 2010-02-07 10:00:00 i will be running this query once a day to grab users. so tomorrow will be: 2010-02-07 14:00:00 2010-02-08 10:00:00 the day after tomorrow will be: ...

Q;Determine date in YYYY-MM-DD HH:MM:SS format

Hi I need to be able to subtract 2hrs ,8hrs, 1 day and 1 week from the current Date. Then convert to yyy-mm-dd hh:mm:ss format. So far I have been unsuccessful. What is the proper method to do this in actionscript? ...

SQLite: date stored as integer, comparision fails.

Hi, I have kind of strange problem ... I have a table which stores a timestamp as integer (realdate field). Now there are the results of selecting items younger than some date: SELECT realdate FROM photos WHERE realdate > 1265410800 array 0 => array 'realdate' => string '1265629201' (length=10) 0 => string '12656...

Simple JavaScript not executing?

What could be the cause of the validateDate() function not to execute when called? The purpose of validateDate() is to take a string like 01/01/2001 and call isValidDate() to determine if the date is valid. If it's not valid, then a warning message will appear. function isValidDate(month, day, year){ /* Purpose: return true i...

Prevent PHP date() from defaulting to 12/31/1969

Hi, I am using a MySQL database with PHP. I store my date values in the database using the DATETIME field. I'm using this PHP code to convert inputted dates to the appropriate format for MySQL. date("Y-m-d H:i:s", strtotime($inputDate)) However, whenever a date is invalid, it is placed in the database as 1969-12-31 19:00:00 Is ther...

In Ruby, why does a equality with nil ("Date.new == nil") return nil?

When writing some rspec today, I came across some unexpected behavior with comparing Date (and Time) instances to nil. Here's a sample using raw ruby (no Rails or other libraries): user@MacBook-Work ~ $ ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] user@MacBook-Work ~ $ irb >> 1 == nil => false >> "string" == nil...