473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Adding a value to a timestamp

How do i display a date as a new column 7 days after the initial timestamp

eg
current timestamp = 20050310000000

if i add 7 days to this won't it result in 20050317000000
eg SELECT *, DATE_FORMAT('%d/%m/%Y' , (dateAuthorised+7)) as expiryDate

I know this is the wrong approach as the timestamp 20050330000000 would
cause an error

Any help would be grateful

Craig
Jul 23 '05 #1
2 2859
On 18/04/2005, Craig Keightley wrote:
How do i display a date as a new column 7 days after the initial
timestamp


SELECT
DATE_FORMAT(ADDDATE(20050418000000, INTERVAL 7 DAY), "%d/%m/%Y") AS
ExpiryDate;

See http://dev.mysql.com/doc/mysql/en/da...functions.html

--
felix
Jul 23 '05 #2
thats great thanks, sorry - forgot to look at the manual

craig
"Felix Geerinckx" <fe*************@gmail.com> wrote in message
news:xn***************@news.easynews.com...
On 18/04/2005, Craig Keightley wrote:
How do i display a date as a new column 7 days after the initial
timestamp


SELECT
DATE_FORMAT(ADDDATE(20050418000000, INTERVAL 7 DAY), "%d/%m/%Y") AS
ExpiryDate;

See http://dev.mysql.com/doc/mysql/en/da...functions.html

--
felix

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Stegga | last post by:
Hi there, I'm trying to add 1 second incrementally to a timestamp while looping through it and I am pulling my hair out. Please can someone help me? example of code: $calc_timestamp =...
0
by: matthew | last post by:
I am using: mysql Ver 12.22 Distrib 4.0.18, for sun-solaris2.9 (sparc) And I do this: mysql> create table test (a timestamp default null, b timestamp default null); Query OK, 0 rows...
2
by: rong.guo | last post by:
Hello Group, I am having a really weird problem... Can anyone tell the difference between Query 1 and Query 2 below? Why Query 2 excludes '2/28/2005'? Many thanks! create table a...
2
by: Mark Hansen | last post by:
I'm trying to convert some schema creation scripts that were used on MS SQL Server to DB2 (v8.2) and have a problem with the following select statement (snippet) used for a view: SELECT col1,...
1
by: Frans | last post by:
Hello All, I have just upgrade my postgresql to 7.4.5-2, but I have problem with default value in postgresql 7.4.5-2, everytime I set default value for varchar or timestamp fields, the result...
5
by: joe donnelly | last post by:
I have a couple of questions about recordsets: 1. When a recordset is summoned by the code where does it actually exist and in what form...is it created in the database (data source location)...
9
by: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= | last post by:
``odict.byindex(index)`` For this API, I think it's important to make some performance guarantees. It seems fairly difficult to make byindex O(1), and simultaneously also make insertion/deletion...
5
by: Henry J. | last post by:
I know this could be a dumb question, I just want to confirm that it is faster to execute inserts, if a timestamp field is set to have a default value, like DEFAULT CURRENT TIMESTAMP, and skip that...
4
by: crs27 | last post by:
Hai All, This is my create statement CREATE TABLE `dbname`.`tablename` ( `vh_id` int(10) unsigned NOT NULL, `gh_utc` time NOT NULL, `gh_mydate` date default NULL, `gh_serverdate_time`...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.