datetime

Workout the string format used for DateTime formatting.

I have a string which represents a DataTime value, and I want to workout what string format was used to create the string. For example - Given "Wednesday 27 Jan 2010" I expect "dddd dd MMM yyyy" - Given "2010 01 27" I expect "yyyy MM dd" Assume that the date is close to DateTime.Now and relates to the CurrentCulture. So given that we h...

SQL Query taking forever

Hi, I have this webapplication tool which queries over data and shows it in a grid. Now a lot of people use it so it has to be quite performant. The thing is, I needed to add a couple of extra fields through joins and now it takes forever for the query to run. If I in sql server run the following query: select top 100 * from bam_Pr...

Need Help Programming in C comparing times together..

Hi Everyone, i need some advice and help with a plugin i am writing for Nagios. i am writing the plugin in C, but have no previous experience in the language except for minor amounts whilst trying to get this plugin to work. basically what i am trying to-do is the following. read a text file that is generated on a remote PC by an appl...

Create a date range in mysql

Best way to create on the fly, date ranges, for use with report. So I can avoid empty rows on my report if there's no activity for a given day. Mostly to avoid this issue: http://stackoverflow.com/questions/75752/what-is-the-most-straightforward-way-to-pad-empty-dates-in-sql-results-on-either ...

DateTime day ending 24:00 (midnight)

I have a customer that wants to see midnight represented as the end of the prior day. Example var date = DateTime.Parse("1/27/2010 0:00"); Console.WriteLine(date.ToString(<some format>)); Display: 1/26/2010 24:00 I believe this is valid in the ISO 8601 standard. (see this) Is there any way to support this in .net (without an u...

[r] How to parse milliseconds in R?

How do I use strptime or any other functions to parse timestamps with milliseconds in R? > time[1] [1] "2010-01-15 13:55:23.975" > strptime(time[1], format="%Y-%m-%d %H:%M:%S.%f") [1] NA > strptime(time[1], format="%Y-%m-%d %H:%M:%S") [1] "2010-01-15 13:55:23"` ...

if timer is elapsed.; i want to run some codes but error return?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Timers; using System.IO; namespace TimerApp4 { class Program { public static int k; static void Main(string[] args) { Timer t = new Timer(1000); t.Elapsed += new ElapsedEventHandler(S...

ISO Time (ISO 8601) in Python?

I have a file. In Python, I would like to take its creation time, and convert it to an ISO time (ISO 8601) string while preserving the fact that it was created in the Eastern Time Zone. How do I take the file's ctime and convert it to an ISO time string, that indicates the Eastern Time Zone (and takes into account daylight savings time,...

Format date in C#

Hi all I have a string used to display the datetime like Mon, dd Dec YYYY hh:mm:ss. I want to show it like dd Dec YYYY. Is there any simple way to do it? ...

javascript: validate time in range

i have a input datetime format: dd/mm/yy hh:mm i use jquery validate to check user' input & it work well. but now, i want validate hh:mm must not in a definite range, example: i have blocking time from 07:00 to 15:00, so hh:mm user input must not in this range. how to validate this using javascript (jquery validate, ...). Thanks. ...

how to find time at particular timezone from anywhere

I need to know the current time at CDT when my Python script is run. However this script will be run in multiple different timezones so a simple offset won't work. I only need a solution for Linux, but a cross platform solution would be ideal. ...

Functions for value intervals

I'm currently dealing with a lot of possibly indefinite date spans, ie. StartDate EndDate --------- --------- 01JAN1921 31DEC2009 10OCT1955 null ... where the other end of the interval might be unknown or not defined. I've been working on little functions for detecting overlap, whether an interval is a subinterval of a...

Wrong date with ruby Date.today and DateTime.now

I've installed ruby-1.8.6-p383 with RVM. System ruby is 1.9.1_p378-1 I'm getting the wrong date from Date.today and DateTime.now when using ruby 1.8.. Whereas Time.now is correct: irb(main):002:0> DateTime.now.to_s => "2126--1-10618T11:23:43+00:00" irb(main):004:0> Date.today.to_s => "2126--1-10618" irb(main):005:0> Time.now => Thu Jan...

Strange .Net datetime issue

Setting with a ternary DateTime filterDate = endDate.HasValue ? endDate.Value : DateTime.Now.AddDays(7); Non ternary DateTime filterDate; if (endDate.HasValue) filterDate = endDate.Value; else filterDate = DateTime.Now.AddDays(7); If you debug these two statements the value of filterDate will not be the same. Why is this? ...

generate days from date range

I would like to run a query like select ... as days where `date` is between '2010-01-20' and '2010-01-24' And return data like: days ---------- 2010-01-20 2010-01-21 2010-01-22 2010-01-23 2010-01-24 ...

How do I turn a python datetime into a string, with readable format date?

t = e['updated_parsed'] dt = datetime.datetime(t[0],t[1],t[2],t[3],t[4],t[5],t[6] print dt >>>2010-01-28 08:39:49.000003 How do I turn that into a string?: "January 28, 2010" ...

Ruby on Rails query by datetime range ( last 24, 48, etc... hours )

I'm trying to build a query that will search for recent entries based on column 'last_login_at'. This is a datetime field with time zone (i.e. Time.zone.now) When I execute User.find(:all, :conditions => ["last_login_at < ?", 24.hours.ago]) I get nothing. Alternatively I can define today as Time.zone.today and yesterday as Time.zone...

Is there a constant describing the minimal Windows FileTime Value in .Net?

I am using the DateTime.ToFileTime and FromFileTime methods to store and retrieve timestamps in a database. The mininum windows file time is midnight, Jan 1, 1601. Is there a constant similar to DateTime.MinValue, that describes this value? ...

PHP convert one date into another date format

Hi, Is there a very simple way in PHP to convert one date format into another date format? I have this: $old_date = date('y-m-d-h-i-s'); // works $middle = strtotime($old_date); // returns (bool)false $new_date = date('Y-m-d H:i:s', $middle); // returns 1970-01-01 00:00:00 But I'd of course like it to r...

Date Time format problem in sql server

I have an application in asp.net which worked fine untill recently when i changed the datetime format in Regional and Language Settings in Control Panel. The date time format was default when i installed XP. I chose Indian standard time while installing XP. I changed the date time format to dd/MM/yyyy HH:mm:ss. And my application start...