datetime

Oracle to_date SQL formatting odd behavior

I've trawled the SO website thinking this is pretty obvious but alas I have not found one yet. Basically the setup is as follows: I have a string in a table like so: 06/22/2010 00:00:00 I do a select on it: SELECT To_Date(item, 'MM/DD/YYYY HH24:MI:SS') from that_table so that effectively I am doing SELECT To_Date('06/22/2010 0...

How to validate expiry date on MySQL query

Here is my current mysql table id | file | expiry_date --------------------------------------- 1 | sample.zip | 2010-02-03 11:07:03 2 | sample2.zip | 2010-07-13 11:07:03 Query: SELECT * FROM download WHERE expiry_date` `how to validate here` I want to validate if expiry_date is expired the file cannot download....

Getting the hour from a datetime?

How can I select the hour from a datetime? I'm looking for the equivalent of Oracle's TO_CHAR( d, 'HH24' ), which would return 17 for 2010-06-23 17:22:31. I tried to find out about the best time (best answer/questin-ration) to ask an SQL-related question on StackOverflow, using Data Explorer. I got it to work, but I'm sure there is a...

Literal does not match format string for Oracle SQL to_date on a string column

Dear SQL Gurus from Stack Overflow: Environment: Oracle I'm trying to understand why I can't do a to_date selection on a table column that contains strings. Note tableZ with a column of name Value in the example below contains a bunch of strings, some of which are the correct format, for example 6/20/2010 00:00:00. tableZ | Value ...

How to compare a datetime type in SQL Server

So I have a column in my DB on SQL Server that is a datetime. I want to do this simple select statement: SELECT * FROM Res Where dateSubmit='6/17/2010 5:01:26 PM' dateSubmit is a datetime data type and my database has a row where dateSubmit is 6/17/2010 5:01:26 PM However, when I execute this statement it returns null. ...

PHP Convert ISO date to more readable format?

Just a simple question. How do I convert a PHP ISO time (like 2010-06-23T20:47:48-04:00) to something more readable? Is there a function already built in PHP? I've looked around but I haven't seen anything to convert times. If there's not a function, is it possible? Thank you ...

Lets say I have a string...how do I convert that to a datetime?

s = "June 19, 2010" How do I conver that to a datetime object? ...

Calculate number of hours between 2 dates in PHP

How do I calculate the difference between two dates in hours? For example: day1=2006-04-12 12:30:00 day2=2006-04-14 11:30:00 In this case the result should be 47 hours. ...

How to get a datetime variable with a value of 00-00 and month ago with a given timezone?

Hello Everybody! I am looking for help to accomplish following task in T-SQL: I have a timezone, and I need to calculate an UTC datetime which is current date minus one month, but has 0 hours and 0 minutes in a given timezone. ...

Java: Iterating through start and end dates, best practice?

What is the best practice to iterate through a start and end date? ...

How can I convert an ISO8601 timestamp into unix time in Perl?

Given a string that represents a date/time in ISO8601 format (e.g. 20100723T073000), I need to ultimately parse this into a user-supplied format using a general strftime format string. In order to do that, I need to convert the ISO8601 timestamp to a Unix timestamp. There are a huge amount of date/time manipulation modules for Perl and I...

TSQL format the date difference to be "YY years MM months and DD days"

Ok this is a little bit of a strange request. We are trying to get a formatted "age" statement to come out in a report in PeopleSoft, it provides a "TSQL" based builder which is fairly unhelpful. We cannot use stored functions and we cannot edit the entire SQL statement as one thing. All we can do is say field by field what the formula i...

Follow up to changing Date format from Time.now to post.created_at

I previously asked a question on stack overflow about how to format my date in a readable manner. This was the gist of it was this. How do I take 2010-06-14 19:01:00 UTC and turn it into June 14th, 2010 The answer that I used was calling post.date and simply adding the below to post.rb @date = Time.now @date.strftime("%B %d, %Y"...

Unit testing a time - based component?

So I'm writing a cache system (not too complicated, but it has very nice semantics) with a ttl (time to live) for items. Of course the ttl must be unit tested, but since one can't inject a new implementaton of "IDateTime" or "ITimeSpan" in C# (because there is no such thing), how would you go about that? Write a new component "IDateTim...

Problem during parsing datetime

Hi, I have problem when im trying parse datetime in format like: "1.00:29:00" 1- days,29-minutes, after invoke DateTime.Parse im getting "String was not recognized as a valid DateTime" thanks in advance for any suggestion. ...

C++ Integer overflow problem when casting from double to unsigned int

I need to convert time from one format to another in C++ and it must be cross-platform compatible. I have created a structure as my time container. The structure fields must also be unsigned int as specified by legacy code. struct time{ unsigned int timeInteger; unsigned int timeFraction; } time1, time2; Mathematically the conv...

datetime issue with xlrd & xlwt python libs

I'm trying to write some dates from one excel spreadsheet to another. Currently, I'm getting a representation in excel that isn't quite what I want such as this: "40299.2501157407" I can get the date to print out fine to the console, however it doesn't seem to work right writing to the excel spreadsheet -- the data must be a date type i...

Combine date and time when date is a DateTime and time is a string.

I am working with an old mysql database in which a date is stored (without a time) as a datetime and a time is stored as a string (without a date). In C# I then have a DateTime with a value like 2010-06-25 12:00:00 AM and a String with a value like 15:02. What is the most concise way to combine these without a lot of overhead? I have ...

how to get datetimepicker value with Date and current time

i have used the GMDatepicker. i need to take the datetime value along with date. my code: DateTime dateval= ((GMDatePicker)GrdDynamicControls.FooterRow.FindControl("frmDateTime")).Date; this gives me the date 6/26/2010 12.00pm. and not the current time. how to get the date with current time over here.....??? ...

Get Ticks per second and convert to String value?

How do I get number of ticks per second of DateTime.UtcNow and convert it to a String value? BAD QUESTION: try again http://stackoverflow.com/questions/3123894/get-ten-millionths-of-a-second ...