I am having problems trying to write the correct code to test whether a string from the keyboard contains a valid date with the correct amount of months, days for each particular month and format mm/dd/yyyy with adjustments for leap years here is what Ive done so far I dont think I am even close but any help would be greatly appreciated...
When writing Perl scripts I frequently find the need to obtain the current time represented as a string formatted as YYYY-mm-dd HH:MM:SS (say 2009-11-29 14:28:29).
In doing this I find myself taking this quite cumbersome path:
man perlfunc
/localtime to search for localtime - repeat five times (/ + \n) to reach the relevant section of...
If I don't care about less than seconds, what should be the recommended type to store my datetime values in sql-server 2005, is it datetime or smalldatetime or else?
...
Hi,
Here's an interesting one... hope I can explain it well...
I have a collection of competitions in a single table in my SQL Server DB. I'm doing a full text search over them, which works fine. However, some of the competitions are closed, and I want these closed comps to show up after the open comps, while still respecting the rank ...
I am speed testing some JavaScript programs by creating a Date object, and using it to get the time in milliseconds before and after the real work of the function. I made the body a simple adding for loop, and then the end is subtracting the old ms from the new ms and printing that. However, everything finishes in 0 milliseconds... which...
Dear all,
I am trying to test how old ago a file was created (in secondes) with bash in a "if" statement. I need creation date, not modification.
Do you have any idea how to do this, without using a command like "find" with grep ?
...
Hi,
I have a DateTime which I want to format to "2009-09-01T00:00:00.000Z", but the following code gives me "2009-09-01T00:00:00.000+01:00" (both lines):
Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffzzz"));
Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, ...
I'm about to start working on a simple calendar app for a website I'm working on (using Django, but that fact's probably not relevant).
I'd like users to be able to enter when an event is in a text box like this:
Every Sunday evening at 7pm
Next Friday
Tuesday 1st Dec 2009
and have my application begin to make some guesses as to whe...
I have this SQL now:
CREATE PROCEDURE dbo.sel_Track_HitsLast30Days(
@projectID int
)
AS
BEGIN
DECLARE @FirstDay smalldatetime, @NumberOfMonths int, @priorMonth smalldatetime
set @priorMonth = (SELECT CAST(
(
STR( YEAR( dateadd(m,-1, getDate()) ) ) + '/' +
STR( MONTH( dateadd(m,-1, getDate()) ) ) + '/' +
STR( DAY( dateadd(m,-1, getDate(...
Possible Duplicate:
Natural/Relative days in Python
Does anyone know where to find a python module that can print a time tuple in format "5 seconds ago", "2 hours ago", "Yesterday", "3 weeks ago" etc?
...
I have an embedded system that currently keeps track of seconds until an event is supposed to occur using a real-time clock driven by a watch crystal.
Now it needs to keep track of the actual date and time. So, I need to be able to calculate the day, month, year, hour, minute and second from a start date/time and offset in seconds.
C...
I am building a web application where users can enter events, including
event title
start date/time
description
The users would like to enter the start date/time including a timezone that corresponds with the location of the event. The events are worldwide so the timezone can change from event to event.
In the SQL Server backend dat...
How do I convert "9/7/2009" into a timestamp, such as one from time()? Do I use strtotime()?
...
Disclaimer: this is needed for an old and ugly codebase that I'd much rather not touch.
There is a table in the database that has a column (among many others) of DATE type.
There is a query (auto generated by Torque criteria - don't ask) with java.util.Date parameter; Torque formats it as full datetime.
So, the query MySQL is get...
I'm getting a result I don't understand in R.
If I use strptime with a year and day formatted %Y-%m (like "2009-12"), I get an NA result. But if I add a day, like "2009-12-01", and change the format string accordingly, I do get a result. Example:
> strptime("2009-12",format="%Y-%m")
[1] NA
> strptime("2009-12-03",format="%Y-%m-%d")
[1]...
The Rails plugin - Searchlogic, from binary logic - offers the ability to filter by date. I have my form set up like so...
<% form_for @search do |f| %>
<%= f.label :start %> <%= f.select :due_at_after, [[['','']],['November', '2009-11-01'.to_date],['December', '2009-12-01'.to_date]] %><br>
<%= f.label :end %> <%= f.select :du...
I'm using the sqlite3 module in Python 2.6.4 to store a datetime in a SQLite database. Inserting it is very easy, because sqlite automatically converts the date to a string. The problem is, when reading it it comes back as a string, but I need to reconstruct the original datetime object. How do I do this?
...
<?php
$start_date = "12/10/2009 11:30";
echo "<br>start_date: $start_date<br>";
$due_date1 = date("m/d/Y H:i", strtotime("+1 day".$start_date));
$due_date2 = date("m/d/Y H:i", strtotime("+2 day 6pm".$start_date));
echo "<br>due_date1: $due_date1<br>";
echo "<br>due_date2: $due_date2<br>";
?>
See my code , I'm trying to get two dat...
How can I convert the nullable DateTime dt2 to a formatted string?
DateTime dt = DateTime.Now;
Console.WriteLine(dt.ToString("yyyy-MM-dd hh:mm:ss")); //works
DateTime? dt2 = DateTime.Now;
Console.WriteLine(dt2.ToString("yyyy-MM-dd hh:mm:ss")); //gives following error:
no overload to method ToString takes
one argument
...
Hello,
I have a string with a date in it formatted like so: YYYYMMDDHHMMSS. I was wondering how I would convert it into a JavaScript Date object with JavaScript.
Thanks in advance!
...