datetime

Safari JS cannot parse YYYY-MM-DD date format?

In a project I am working on, I need to validate a date entered into an <input type="date"> With Safari 4/5 (on Mac OSX) the Javascript fails to parse dates of the format YYYY-MM-DD, returning NaN instead of the expected epoch timestamp. I am using the following technique to validate the field just before the form is submitted: //valu...

LINQ Average TimeSpan?

Hello all, I have a database table that contains entries for start time and end time of an event. I would like to take those entries and find the average length of an event. The subtraction is no problem. However, when I try to get the average value, the compiler complains. Here is my current LINQ query: public TimeSpan? getAverageTim...

How do I set the date to the next weekday of my choice using c++?

I would like to determine the next date that has a day of the week value equal to something I specify. For example, today is 6/21/2010 and the day of week value is 1 b/c today is a Monday. How do I find the next date with let's say a day of week value of 3. I would like to consider all cases that come close to the end of something incl...

Drupal 6: Date module and displaying only DATE value, without TIME

Hi friends, I'm a newbie drupal guy, I use http://drupal.org/project/date module for my events date, but this module displays TIME as well as default, and I can't turn that off from configuration pages unless I'm a blind :/ is there any way to display only DATE value? Appreciate helps!! thanks a lot! ...

Python: Not all of arguments converted during string formatting

Im wrtiting a script which saves the current date and time as a filename but I get an error stating "TypeError: not all arguments converted during string formatting" I am new to Python andmay of missed something obvious. Code below: from subprocess import Popen import datetime today = datetime.date.today() today = str(today) print to...

[R] How to create multi-panels plots with scatterplot/xyplot and POSIX time objects?

Hi! A newbie question. (ADDED NEW INFO) I have a set of time stamped data that were collected randomly. I like to create a matrix of plots, but I could not create using either scatterplot or xyplot & time objects. my data dataset$Time #POSIX time objects (no set sampling period) #i built POSIX time objects by dataset$T...

Subtracting dates in PHP

I have timestamps stored in the format YYYY-MM-DD HH:MM:SS (for example 2010-06-21 20:12:56). What would the best way to check how old the timestamp is? For the moment I am mainly interested in the number of days old. ...

Reset value of WPF Tookkit datepicker to 'default' value

When I first open my window that uses the wpf toolkit datepicker it has today's date highlighted in the calendar but nothing in the associated textbox (expect a water mark of mm/dd/yyy). I want to reset the datepick to that initial state after a user selects a date and "submits" so when they use it again it not at the date they previous...

Need help in converting String to Date format in Sybase

Hi, I am trying to convert two types of string into date format, however not able to do either of them. The problematic input strings with expected output are as follows: Input 1: 20100614191522 Expected output 1: 6/14/2010 7:15:22 PM Input 2: 2010/12 Expected output 2: 12/1/2010 12:00:00 AM I tried like , select convert(d...

Parsing RFC3339 dates in C++

Are there any functions available to parse an RFC3339 date in C++ (even if they are Win32 specific)? I was previously using Qt and the QDateTime::fromString() function to parse the date but I am now using plain old Win32 C++ (No MFC) and I'm struggling to find a way to do it. If there is no standard in way I can write my own but just in ...

How do I convert 12 hour clock time into 24 hour clock time in PHP?

I am using following function and I want time in 24hr clock format but this gives me time in 12hrs: <?php date_default_timezone_set('Asia/Kolkata'); $timestamp = date("d/m/Y h:i:s", time()); print $timestamp ; ?> What am I doing wrong? ...

converting a date to a time in java

hi, how to convert a date type in java to a time type. thanks for help. ...

Passing a parameter value to SQL stored proc of an optional string in asp.net

I have a search page, which has Date text field. The user may or may not populate this field. But the field is a parameter of a SQL stored proc that gets called to execute the search query. When I walk through the code (and the Date field is blank), I get an error that the value could not be converted to DateTime How can I convert a nu...

Not grouping by date?

I have a database table that stores document information (DocID, Name, Type, Owner, etc). Then I have another table that stores the times the document has been downloaded (DocID, DownloadTime, etc). I'm trying to set up a page for recording the number of hits that different kinds of documents (policies, forms, publications, etc) get in a...

Win32: How to prevent DateTimePicker from accepting 2-digit years?

Microsoft's DateTimePicker common control shows ShortDate's according to the configured Locale settings. The customer's computer is configured with a 2-digit year ShortDateFormat (d/M/yy), so the DateTimePicker shows 2-digit years: When the user puts focus in the year block of the datetime picker, Microsoft points out the issue, and s...

Convert time string expressed as <number>[m|h|d|s|w] to seconds in Python

Is there a good method to convert a string representing time in the format of [m|h|d|s|w] (m= minutes, h=hours, d=days, s=seconds w=week) to number of seconds? I.e. def convert_to_seconds(timeduration): ... convert_to_seconds("1h") -> 3600 convert_to_seconds("1d") -> 86400 etc? Thanks! ...

Date difference in date in Oracle and Java

Hi all, following problem is bothering me and I can't find any reasonable explanation and a solution. Perhaps someone could enlighten me. I have an application that calculates date difference (in days) - in a Search mask and in a Details mask. In the first mask I use days to filter out records with a duration search criteria (Search ma...

Format a Date into Mai 2010 in T-SQL

Dear interested reader, how do I format a date (smalldatetime) in Mai 2010 (i.e. 06.05.2010 => Mai 2010 or 06.10.2009 => October 2009) thx a lot... greetings ...

Datetime.now() abnormality - Python

Hi folks, I'm serving a Python app through Django. Within the app I'm storing the classic "created" field within a few tables. This is how the field looks like within the Django form: created = models.DateTimeField(blank=True, default=datetime.now()) Unfortunately, datetime.now() is not accurate. In fact in the database I have set...

Convert DateTime.Ticks to MySQL DateTime in query

I have a integer column in MySql storing the DateTime.Ticks. A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond. The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 How can...