How to convert full date/time to timestamp?

Let’s learn how to convert full date/time to timestamp. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

Bash script to convert a date and time column to unix timestamp in .csv

I am trying to create a script to convert two columns in a .csv file which are date and time into unix timestamps. So i need to get the date and time column from each row, convert it and insert it into an additional column at the end containing the timestamp. Could anyone help me? So far i have discovered the unix command to convert any give time and date to unixstamp: date -d "2011/11/25 10:00:00" "+%s" 1322215200 I have no experience with bash scripting could anyone get...

Answer:

You don't provide an exerpt from your csv-file, so I'm using this one: [foo.csv] 2011/11/25;12:00:0...

Read more

Euan Hume at Stack Overflow Mark as irrelevant Undo

Other solutions

Should you use DATETIME or TIMESTAMP format in MySQL if you do many ORDER BYs on this field?

I have a table with over a 1.1 million rows. I frequently select the first 25 order by timestamp desc. I have an index on this field and it performs pretty reasonably, however, I'm looking for optimum performance... would it help to move to datetime...

Answer:

The important thing is that you're using an index for the sort. The difference between a DATETIME and...

Read more

Bill Karwin at Quora Mark as irrelevant Undo

How can I convert this string into a datetime in MS SQL Server 2000?

How can I convert a char value that I receive from an external data source with a value of '2006926' (supposed to represent September 26 2006 ) to a datetime datatype? Note the '0' is missing from the month. I can not find a way to convert this to a...

Answer:

If your day parameter is ever less than two characters, your data-architect should be shot, as there...

Read more

I dont know physics at Yahoo! Answers Mark as irrelevant Undo

What's the easiest way to convert a datetime or fixed_datetime object in Python to epoch seconds?

Basically, I want the inverse of datetime.datetime.utcfromtimestamp()

Answer:

The best way that I'm aware of is: import time time.mktime(my_datetime_obj.timetuple()) which will...

Read more

Charlie Cheever at Quora Mark as irrelevant Undo

How to find the difference in hrs/min between two time values? This is related to timestamp and datetime in sq?

I have a system that collects the time a user checks in, but i need to find if the person is late or not via subtraction from an employee schedule within the db. How do I go about this. How do I turn the timestamp into a time value without the date value...

Answer:

If you're working with PHP you can use the unix time format. Unix time is time measured in seconds since...

Read more

Briar Leech at Yahoo! Answers Mark as irrelevant Undo

What function in Python and PHP can convert time in specified time zone to Unix timestamp?

I have a lot of times in various time zones to process, but the mktime() function in both PHP and Python have no parameters about time zone, it just convert to timestamps in my system time zone. Is there any function accept a argument such as +32400...

Answer:

In both of those libraries, there is a way to set the time zone used for mktime(). In PHP, it is date...

Read more

Xuan Luo at Quora Mark as irrelevant Undo

Which is more computationally expensive, trying to acquire a read/write lock or doing a few datetime comparisons?

I have the following options in designing a block of code. In this design, we do a comparison and only if it's true we try acquiring the lock. if((DateTime.Now - timeStamp) < new TimeSpan(24,0,0)){ if(rwlock.tryWrite(4000)){ // blocks for 4s ....

Answer:

Go for the first solution, for sure. Acquiring a lock implies much more work than a small bench of arithmetic...

Read more

Marc Dousset at Quora Mark as irrelevant Undo

Why is my yahoo mail timestamp in Pacific Daylight Time when I live in NY?

I posted a question about how to find the timestamp on my yahoo mail and i got some ans and a direction to a site called timeanddate.com..i;m still kinda confused on how to change the numbers into my time in NY especially since now I found out that the...

Answer:

Because Sunnyvale, CA is where Yahoo! has their main offices. All time is West Coast time to them! .

Read more

tha1n0nl... at Yahoo! Answers Mark as irrelevant Undo

Answer:

DateTime: has a range of '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. TimeStamp: has a range of ...

Read more

Josh Thornton at Quora Mark as irrelevant Undo

What format is this timestamp: 2456799.87848174 ?

I have an excel sheet of data extracted from a SQL database. A column in the table is headed "time" and has the following format: 2456799.87848174. How do I convert this to a human readable date and time, or even a unix timestamp? I think the...

Answer:

These appear to be in Julian Day Format, possibly from SQLite.

Read more

Morsey at Ask.Metafilter.Com Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.