datetime

delete files from the folder older than 4 days.

Hi, I would like to run a timer for every 5 hours and delete the files from the folder older than 4 days. Could you please with sample code? Thank you.. ...

pytz localize vs datetime replace

I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments to the localized datetime: .localize behaviour: >>> tz <DstTzInfo 'Africa/Abidjan' LMT-1 day, 23:44:00 STD> >>> d datetime.datetime(2009, 9, 2, 14, 45, 42, 91421) >>> tz.localize(d) datetime.datetime(2009, 9, 2, 14, 45, 42, 91421, ...

manipulating time in python

In the code shown below, I need to manipulate the time var in python to display a date/time stamp in python to represent that delay. for example, when the user enters the delay time in hours, i need to set the jcarddeliver var to update itself with the value of the current date/time + delay also it should update the date var as well. for...

Hidden Boxing in the BCL?

Recently I became aware that there are some parts in the BCL that still use some "legacy" code that was probably written before generics were introduced in v2.0 of the framework. Apparently, parts of that "legacy" code may cause the CLR to perform numerous boxing/unboxing operations. Since excessive usage of boxing is never a good thing...

To add one month to current date

hi guys, I have to add one month to todays date and have to get date after 1 month.Can anybody help? ...

ASP.NET Date/Time Conversions

I think I am overthinking this issue a little and I'm hoping someone can help me out. I have an ASP.NET application with a SQL Server back end. I am storing all my dates in UTC format and doing the appropriate conversions to the local time zone of the browser viewing it. One of the pages asks for a start date and end date (no times). ...

Shall I bother with storing DateTime data as julianday in SQLite?

SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions). However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted strings. Why are they doing so? I'm usually trying to adapt the frameworks to storing d...

Problem in Rails scaffold for DATE fields

When I use Rails scaffold, I can't access the page to edit fields. It shows me some kind of problem with all DATE fields. Here's the error: can't convert Symbol into String Extracted source (around line #124): 121: </p> 122: <p> 123: <%= f.label :dataDeCadastro %><br /> 124: <%= f.date_select :dataDeCadastr...

Convert times created by Javascript's getTime() method to ruby Time objects

Javascript's getTime() method returns the number of milliseconds since midnight of January 1, 1970. How do I convert the output of getTime() to a Ruby Time object? ...

Convert Time from one time zone to another in Rails

My created_at timestamps are stored in UTC: >> Annotation.last.created_at => Sat, 29 Aug 2009 23:30:09 UTC +00:00 How do I convert one of them to 'Eastern Time (US & Canada)' (taking into account daylight savings)? Something like: Annotation.last.created_at.in_eastern_time ...

Set Default DateTime Format c#

Is there a way of setting or overriding the default DateTime format for an entire application. I am writing an app in C# .Net MVC 1.0 and use alot of generics and reflection. Would be much simpler if I could override the default DateTime.ToString() format to be "dd-MMM-yyyy". I do not want this format to change when the site is run on...

sas informat datetime

Can anyone advise on the appropriate SAS informat to read in a datetime (dd/mm/yyyy hh:mm) ??? eg data _null_; informat from_dt datetime????.; input from_dt ; put from_dt=; cards; 01/01/1960 00:00 ;run; ...

Selecting by datetime field in SQL Server

Select col1 FROM mytable WHERE ValidUntil > 7/9/2009 8:45:30 pm and the error is Incorrect syntax near '8'. So what is wrong with this sql statement? I tried this directly on SQL management studio... ...

Exploding date string into separate span elements in Ruby

Hi, I'm looking for the best way to take a datetime string from MySQL, explode it in Ruby and return the month, date, and year in separate elements. ...

does timespan take into account leap year when calculating days between two random dates?

For example: DateTime date1 = new DateTime(1955, 12, 12); DateTime date2 = new DateTime(1967, 3, 6); TimeSpan fff = date2 - date1; Will it calculate number of days correctly? (taking leap year into account) ...

Display DateTime on linechart

I need to create LineChart that display datetime points, for example: public var stockDataAC:ArrayCollection = new ArrayCollection( [ {date: "2005,7,27,22,15,30", close: 41.71}, {date: "2005,7,27,22,16,30", close: 42.21}, {date: "2005,7,27,22,17,30", close: 42.11}, {date: "...

How to get a Long Date format from DateTime without a weekday

I'm looking for a locale-aware way of acquiring a long date time without the weekday. Just such a beast exist? Below is the code I use to get the long date format including the weekday: DateTime time = ... String formattedDate = time.ToLongDateString(); Edit Examples of what I would like to see: en-us: December 5, 2009 fr-fr: 5 d...

Calculating time blocks from given date range

I'm trying to calculate time blocks from given date range. Here's my attempt: <?php class timeRangeCalculator { /** * Start time of block * * @var DateTime */ private $blockStart; /** * Block duration in seconds * * @var int */ private $blockDuration; /** * Start of range * * @var DateTime ...

jQuery DatePicker to C#

Hello, At this time, I'm doing this : var dateSelected = $("#datepicker").datepicker("getDate"); alert(dateSelected.getDate()); alert(dateSelected.getMonth()); alert(dateSelected.getFullYear()); dateSelected value look this : Fri Sep 11 2009 00:00:00 GMT+0200 (Romance Daylight Time) 2 Options : a) Is it possible to use this in .NET...

How do I format a DateTime? in c#?

I have a DateTime? field. Its currently storing UT. I would like it to store time in the format I provide. In this case: "dd.MM.yyyy HH:mm:ss" How can I change the value of the DateTime? field to hold a formatted value instead. ...