Results 1 to 3 of 3

Thread: calculate number of days

  1. #1
    Join Date
    Oct 2002
    Location
    queens
    Posts
    139

    calculate number of days

    I need to add days to a date field, my date field is as varchar(20041030 for example) and I need to add 4 days to it, my result should be 20041103, result field is also in varchar,how would I do that, can anyone pls help?

    thx in advance!!

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    create table test1 (date varchar(8))
    insert into test1 select '20041030'
    insert into test1 select '20040829'
    insert into test1 select '20040909'

    select date ,convert(varchar(8),dateadd(dd,4,date),112) as mydate from test1

  3. #3
    Join Date
    Oct 2002
    Location
    queens
    Posts
    139
    Thanks Mak!! Works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •