datetime

How to update datetime field

What is the best way to update a datetime field in a form. I have a form and need to update both the date and the time. I need to update the date with a date_select and then update the time using a time_select I only have 1 field in my database. Event:date I need to save the date in one field and then update the same field but add ...

Selecting between two dates within a DateTime field - SQL Server

How to select records between a date to another date given a DateTime field in a table.... ...

Parse string pattern into Date in Flex

Hi Friends, Is there some way in flex to parse strings to date. I want it to support custom formats similar to 'dateformatter'. Using 'dateformatter' class we can parse date object in various string formats as specified by 'formatString property'. I want it other way round, from string to date. The parse method 'Date.parse(my_string)' do...

first time I have to create an extension for linq2sql, how to do this one?

I have this one line property Public ReadOnly Property DateToUniversal(ByVal dt As Nullable(Of Date)) As String Get Return If(dt.HasValue, dt.Value.ToString("u").Substring(0, 10), "") End Get End Property if i'm trying to use that into a from n in mydatacontext select new myObj {n.field1,n.field2, DateToUniversal(n....

Convert dd/MM/yyyy hh:mm:ss.fff from String to DateTime in C#

I am trying to convert a string of the below format dd/MM/yyyy hh:mm:ss.fff into DateTime value easiest way? BTW IFormatProvider culture = new CultureInfo("en-US", true); DateTime.ParseExact(timeString, "dd/MM/yyyy hh:mm:ss.fff",culture); Throws an invalid time exception Eg. 11/12/2009 13:30:00.000 Where 12 is the month (i know wei...

Why won't this simple SQL statement work?

dateposted is a MySQL TIMESTAMP column: SELECT * FROM posts WHERE dateposted > NOW() - 604800 ...*SHOULD*, if I am not mistaken, return rows where dateposted was in the last week. But it returns only posts less than roughly one day old. I was under the impression that TIMESTAMP used seconds? IE: 7 * 3600 * 24 = 604800 ...

timestamp in database

Hello all, This is a very simple question. Some dates and timestamps are generated in my database. How is this mdate build up so I can see what date and time is stored? 1st 1259575339 2nd 1261296844 I couldn't find a converter for this. I have read that it's the the amount of seconds since 01-01-1970, is this correct? ...

Why does Rails always display a datetime as 1/1/2000 - with the correct time

This one is driving me nuts!! The data is getting stored into the db (sqlite3) correctly. However, when I display the date from the record, Rails appears to coerce it to 1/1/2000 - with the correct time. In other words, if I specify this as the date time: December 31, 2009 6:00 PM, sqllite3 will in fact show 2009-12-31 18:00:00. But.... ...

Parse Facebook feed datetime in python?

I am reading a Facebook updates feed using the python library 'feedparser'. I loop through the collection of entries in my Django templates, and display the results. The updated field is returned in a big long string, of some format I am unfamiliar with. Tue, 01 Dec 2009 23:55:52 +0000 How can I... A) Use a Django filter to clean th...

Difference between dates in javascript

how to find difference between two dates ...

How to do "Due in X days/time" for a todo app in rails?

Say I have a todo app that has title and due_date fields. How do I say "Due in X days?" If a certain todo is due on Dec 29, it should say due in 2 days, X hours. I suppose it was to do something with Time.now. I understand there's a <%= distance_of_time_in_words_to_now%> is there an opposite to that? Thanks ...

What's wrong with Java Date & Time API?

Very often I come across negative feedback on Java Date and other date-time-related classes. Being a .NET developer, I cannot fully (without having used them) understand, what's actually wrong with them. Can anybody shed some light on this? ...

In Java, how to get the difference between 2 dates in seconds?

The Java class library has a class named DateTime. DateTime has this method: int daysBetween(DateTime other) which returns the number of days between this and the parameter. It doesn't have a method int secondsBetween(DateTime other) which I happen to need. Is there a class which is similar to DateTime but has such a method? ...

Finding runs of a particular value

I have a table in Oracle 10 that is defined like this: LOCATION HOUR STATUS -------------------------------------- 10 12/10/09 5:00PM 1 10 12/10/09 6:00PM 1 10 12/10/09 7:00PM 2 10 12/10/09 8:00PM 1 10 12/10/09 9:00PM 3 10 12/10/09 10:00PM 3 10 ...

Axapta: Convert utcDateTime to date

What is the best way to convert a utcDateTime value to a date type so I can use the global datetime functions on it? int timeDiff; date _now = systemdateget(); ; select firstOnly myUTCDateTime from _myTable timeDiff = Global::yearDiff(_now, _myTable.myUTCDateTime); info(strfmt('%1', timeDiff); Thanks ...

What is the least number of bytes for representing date and time?

I need to transfer the current operating system's date and time up to micro-seconds accuracy from party A to party B over TCP/IP. What is the least number of bytes that can be used to represent this without sacrificing accuracy? And how to convert the date and time to your bytes format using C#? ...

Generate random date between two dates using php

I am coding an application where i need to assign random date between two fixed timestamps how i can achieve this using php i've searched first but only found the answer for Java not php for example : $string = randomdate(1262055681,1262055681); ...

MM-DD-YYYY to day of week, analyzing consecutive working days

I'm analyzing data based on x consecutive working days, M-F (and later skipping selected holidays). My plan is to take MM-DD-YYYY and determine the day of the week. How can I do this in VBA? I found this simple way using .NET but how do I call from Office 2007 VBA, and what reference do I need to add? DateTime.Parse("2009-10-02"...

How to store time created in MySQL table?

I want to store the timestamp which a row was inserted into a MySQL table with the row, to be later compared to other times. What's the best field type for this and what's the best way to insert the row with the timestamp in PHP? ...

How do I convert a DateTime to a Date in C#

I can't believe how long it's taken me to fail at finding the answer to this seemingly obvious question. Date SomeRandomMadeUpDate = DateTime.Now.AddMonths(randomMonths).Date; Cannot implicitly convert type 'System.DateTime' to 'System.Date' I can even call: Date.Now but calling .AddDays on it returns a DateTime. Again,...