Adding a value to a timestamp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Craig Keightley

    #1

    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


  • Felix Geerinckx

    #2
    Re: Adding a value to a timestamp

    On 18/04/2005, Craig Keightley wrote:
    [color=blue]
    > How do i display a date as a new column 7 days after the initial
    > timestamp
    >[/color]

    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

    Comment

    • Craig Keightley

      #3
      Re: Adding a value to a timestamp

      thats great thanks, sorry - forgot to look at the manual

      craig


      "Felix Geerinckx" <felix.geerinck x@gmail.com> wrote in message
      news:xn0e15a786 bzp8000@news.ea synews.com...[color=blue]
      > On 18/04/2005, Craig Keightley wrote:
      >[color=green]
      >> How do i display a date as a new column 7 days after the initial
      >> timestamp
      >>[/color]
      >
      > 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[/color]


      Comment

      Working...