Solved

convert date and time to integer

Posted on 2006-11-07
3
439 Views
Last Modified: 2008-02-01
hi,

Please assist how can we convert date and time value to integer?



Thanks
0
Comment
Question by:FrankPorter
3 Comments
 
LVL 14

Assisted Solution

by:mherchl
mherchl earned 50 total points
ID: 17890643
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

can you give an example, what you exactly want to do?

0
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 350 total points
ID: 17890691
If you're trying to get a PHP timestamp, the way to do it is just:

SELECT UNIX_TIMESTAMP(column_name)
FROM the_table;

0
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 100 total points
ID: 17894937
I'd reccomend that you use UNIX_TIMESTAMP

however you could also use a number yyyymmddhhnnss which would also be an integer (the maths would not be good with it either)
Date_Format(now(), '%Y%m%d%H%i%S')
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question