datetime

Hour from DateTime? in 24 hours format

Hello to everyone, So i have this DateTime? and what i want to do is to obtain the hour but show it in 24 hours format. For example: If the hour is 2:20:23 p.m. i want to convert it to 14:20 and that's it. I'm working with Visual C#. Any ideas please, thank you. I have something like this public static string FormatearHoraA24(DateT...

How to list all the objects with a specific date no matter the time in a DateTime Field

I Have a model like this foo=models.char bar=models.dateime In wich several foos arrives in one day in different time. I need to list all the foos in a specific date, no matter the time they arrive. I can't change the model, so splitting the bar in two fields(one for date and one for time) is out of reach right now :( ...

How to MySQL Trigger to update a field whenever any record is touched?

I haver zero experience with triggers in MySQL. Learnt them in school (Oracle environment). I have a table which already has a datestamp column for insert date. I want to update a Record_Touched field whenever any record is touched in this table. What is the best efficient way of doing it? Thank you... ...

C# DateTime to "YYYYMMDDHHMMSS" format

Hi, I want to convert a C# DateTime to "YYYYMMDDHHMMSS" format. But I don't find a built in method to get this format? Any comments? ...

Convert String value format of YYYYMMDDHHMMSS to C# DateTime

I have a need to convert a string value in the form "YYYYMMDDHHMMSS" to a DateTime. But not sure on how, may be a DateTime.Tryparse can be used to make this happen. Or is there any other way to do it. I can do this using some string operations to take "YYYYMMDD" alone, convert to a datetime and then add HH, MM, SS separately to that Date...

Is there a better way to format this date string

Hello is there are better way to structure this line of code, as you can see, I am changing the format of a string that contains a date. lblCourseStartDate.Text = String.Format("{0:D}", DateTime.Parse(CourseStartDate)); I just found it untidy that I am converting twice or three times to get the format I want. Thanks ...

Rails: Accessing previous loop in Populator (rake db:populate)

I am populating my Rails database using populator, and I have a case where I would like to build a series of records where fields start_date and end_date follow seamlessly from each other (from today back into the past). Here is a sample of what I'm doing: # populate.rake Chain.populate 1 do |ch| ch.date_end = DateTime.now ch.date_...

Add not null DateTime column to SQLite without default value?

It looks like i cant add a not null constraint or remove a default constraint. I would like to add a datetime column to a table and have all the values set to anything (perhaps 1970 or year 2000) but it seems like i cant use not null without a default and i cant remove a default once added in. So how can i add this column? (once again ju...

php add hours to date output wrong result

Basically what I want to do is to send an email to follow up on order placed in 3 hours later. What I try to do is to get the current date (up to hours level), then compare with the orderdate+ 3 hours, to see whether it match. Example orderdate: 2010-06-12 18, after add 3 hours should become 2010-06-12 21 However, after add hour, the ...

AS3: how to get current calendar week

How can I get the current calendar week with AS3 ? I've not found any information by using the official adobe online-reference (check: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Date.html) or using google's web search. Thank you soo much! Kind Regards, msec ...

Compare DateTime ticks on two machines

Is it a viable option to compare two FileInfo.CreationTimeUtc.Ticks of two files on two different computers to see which version is newer - or is there a better way? Do Ticks depend on OS time or are they really physical ticks from some fixed date in the past? ...

set default value for DateTime in optional parameter

how i can set default value for DateTime in optional parameter? public SomeClassInit(Guid docId, DateTime addedOn = DateTime.Now???) { //Init codes here } ...

How can I calculate new time zone in python ?

Hello, Lets say I have a time 04:05 and the timezone is -0100 (GMT) I want to calculate the new time which will be 03:05 Is there any function in python to do that calculcation ? Thanks ...

Rails created_at on display if Today?

Hi Everyone, Is it possible to display the created_at date, only if that date matches today's date? <%=h k.created_at %> Is this possible? Or should it be done in the controller rather than the view? Thanks, Danny I have the following in my environment.rb: ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(:def...

Rails helper, show word not date.

Hi Everyone, A follow on from this questions: http://stackoverflow.com/questions/3032598/rails-created-at-on-display-if-today Is it possible to output the word TODAY rather than the date when using the following helper? def created_today k k.created_at if k.created_at.to_date == Date.today end <%=h created_today(k) %> Thanks,...

Plotting a cumulative graph of python datetimes

Say I have a list of datetimes, and we know each datetime to be the recorded time of an event happening. Is it possible in matplotlib to graph the frequency of this event occuring over time, showing this data in a cumulative graph (so that each point is greater or equal to all of the points that went before it), without preprocessing th...

AbsoluteTime with numeric argument behaves strangely.

This is strange: DateList@AbsoluteTime[596523] returns {2078, 7, 2, 2, 42, 9.7849} But DateList@AbsoluteTime[596524] returns {1942, 5, 26, 20, 28, 39.5596} The question: What's going on? Note that AbsoluteTime with a numeric argument is undocumented. (I think I now know what it's doing but figured this is useful to have as a...

Django display notifications by day

hi guys, i have a notification list, and i want to order them by day, meaning, that i want to have in my notification list every day a title like 'Monday 16th od September' and the notifications for that day. I did not find anywhere how it should be done thanks a lot! ...

How can I find the most recent month end date with Joda time?

Say a month end date is the date in a month which is the last non-weekend and non-holiday day in that month. How can I find the most recent past month end date with Joda time? For example, the answer for today would be Friday 28th May because that was May's month end and May was the most recent month to end. ...

GPS Time Representation library

I am looking for a Java library that handles conversion to/from GPS Time. GPS Time has an epoch of 6 January 1980, and does not have leap seconds, so it differs from the more standard time representations. Here is the relevant description from wikipedia: While most clocks are synchronized to Coordinated Universal Time (UTC), the ...