Page 1 of 1

How to minus one day from a give timestamp data

Posted: Thu Dec 18, 2008 8:35 am
by prams
Hi All,
i have a requirement like

i need to subtract one day from given time stamp

how to do in trnsformer, can any one help me in this regard

Thanks & Regards
Prams

Posted: Thu Dec 18, 2008 9:02 am
by chulett
Investigate the use of the DaysFromDateSince function, both by searching here and by reading the documentation.

Posted: Thu Dec 18, 2008 3:40 pm
by ray.wurlod
Probably DateFromDaysSince() would be more appropriate.

Posted: Thu Dec 18, 2008 3:49 pm
by chulett
Whoops, that was what I meant but not what came out of my fingers. :oops:

Damn fingers.

Posted: Wed Dec 24, 2008 5:45 am
by prams
Thanks for the input,

by using DateFromDaysSince()
i am able to get the date which is required but i need the time stamp also,

is there any option to to get timestamp also

input is timestamp and out put is also timestamp.

but now i am getting like
input is timestamp and output is date format.

thanks for the valueable input

Thanks & Regards
Prams

Posted: Wed Dec 24, 2008 8:59 am
by chulett
Data format? Does the timestamp need to be converted? If not, simply cat it back on the end of the converted date.

Posted: Wed Dec 24, 2008 2:36 pm
by ray.wurlod
You will need to decompose your input timestamp into date and time components, adjust the date component, then reassemble. You do not have to convert to string (which is what Craig suggests) - there are functions such as TimestampToDate() that you can use.

Posted: Fri Dec 26, 2008 1:01 am
by prams
Thank you chulett and ray.wurlod for your valueable input.

its working

Thanks & Regards
Prams

Posted: Mon Dec 29, 2008 2:57 pm
by fmcmullan
I have used TimestampFromSecondsSince(-86400, X) to do this without having to deconstruct/reconstruct anything. It has worked well for me.

Posted: Mon Dec 29, 2008 7:44 pm
by ray.wurlod
Beware that 2008-12-31 has 86401 seconds!