473,771 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2887
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(ADD DATE(2005041800 0000, 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.ea synews.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(ADD DATE(2005041800 0000, 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
4702
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 = date('YmdHis',mktime(date('H'),date('i'),date('s')-50,date('m'),date('d'),date('Y')));
0
1598
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 affected (0.03 sec) mysql> desc test;
2
5183
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 (ApplicationID int ,timestamp datetime)
2
9238
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, col2, timestamp-col1, TO_CHAR(timestamp-col1, 'HH24') FROM ...
1
2608
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 value always change to sometihing like this : I set the default value to '1900-01-01 00:00:00' , but the result is '1900-01-01 00:00:00'::timestamp without time zone I've tried to erase the "::timestamp withut time zone" but it didn't work.
5
1604
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) as a new table that mimics the actual database table and contains the fields and rows asked for in the query? It is somewhat vague as to it's true nature in the materials I have rummaged through lately. 2. When an UPDATE code command is given...
9
175
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 better than O(n). IOW, the PEP should somehow specify which operations are efficient, and which ones aren't. Regards,
5
4841
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 column in inserts, than to include explicit timestamps in the inserts and let the DB insert them. Thanks!
4
15009
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` timestamp NOT NULL default CURRENT_TIMESTAMP, KEY `FK_geo_gpsdata_2` (`vh_id`)
0
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.