Page 1 of 1
i want to add hours to timestamp .
Posted: Thu May 12, 2005 11:20 am
by sanjay
Hi
i want to add hours to timestamp . is it possible in Parallel Extender 7.5
Sanjay
Posted: Thu May 12, 2005 4:39 pm
by T42
Yes.
![Razz :P](./images/smilies/icon_razz.gif)
Posted: Thu May 12, 2005 4:55 pm
by T42
Code: Select all
TimeFromMidnightSeconds(((HoursFromTime([input time]) * 3600) + (MinutesFromTime([input time]) * 60) + SecondsFromTime([input time])) + [hours * 3600])
This will work for "Time" field. Have fun with the "Timestamp" version.
![Smile :)](./images/smilies/icon_smile.gif)
adding hour to timestamp (Urgent Help Required)b
Posted: Sun May 15, 2005 1:02 am
by sanjay
i am finding difficult in adding hour to timestamp field for in Parallel extender . my
timestamp field : '2004-10-28 10:22:33' want add 10 hours to the field . can anyone help me . i want to do it in PX
sanjay
T42 wrote:Code: Select all
TimeFromMidnightSeconds(((HoursFromTime([input time]) * 3600) + (MinutesFromTime([input time]) * 60) + SecondsFromTime([input time])) + [hours * 3600])
This will work for "Time" field. Have fun with the "Timestamp" version.
![Smile :)](./images/smilies/icon_smile.gif)
Posted: Sun May 15, 2005 5:00 am
by ahmediftikhar
Lets say your input is
DateIn = '2004-10-28 10:22:33'
Following are the stage variables used:
SDate : Field(DateIn," ",1)
STime : Field(DateIn," ",2)
SHours: 10
SAddTime: TimeFromMidnightSeconds(((HoursFromTime(STime) * 3600) + (MinutesFromTime(STime) * 60) + SecondsFromTime(STime)) + (SHours * 3600))
Output:
SDate : " " : SAddTime
Result : 2004-10-28 20:22:33
Its the same solution given by T42 in explanatory steps
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Sun May 15, 2005 5:27 am
by Prashantoncyber
How you going to increase the date if after adding the hours , date gets incremented?
Regarding adding hourse to timestamp
Posted: Sun May 15, 2005 6:07 am
by sanjay
hi ahmediftikhar
thanks
but how the date will increase because u are just concatenating.
Sanjay
Prashantoncyber wrote:How you going to increase the date if after adding the hours , date gets incremented?
Posted: Sun May 15, 2005 6:35 am
by ahmediftikhar
Its very simple add two more stage variable
SAddHours: HoursFromTime(STime) + SHours
SAddDate : If SAddHours > 23 Then DateFromDaysSince(Div(SAddHours,24),SDate) Else SDate
Output is SAddDate : " " : SAddTime
Hope this helps
Ahmed.
Regarding adding hour to timestamp
Posted: Sun May 15, 2005 6:52 am
by sanjay
Thanks ahmed u have made my task simple
but one clarification required
regarding
SAddTime : TimeFromMidnightSeconds(((HoursFromTime(STime) * 3600) + (MinutesFromTime(STime) * 60) + SecondsFromTime(STime)) + (SHours * 3600))
above function
suppose time : 16:00:00
if u are adding 10 hrs will it make it 06:00:00
Regards
Sanjay
ahmediftikhar wrote:Its very simple add two more stage variable
SAddHours: HoursFromTime(STime) + SHours
SAddDate : If SAddHours > 23 Then DateFromDaysSince(Div(SAddHours,24),SDate) Else SDate
Output is SAddDate : " " : SAddTime
Hope this helps
Ahmed.
Posted: Sun May 15, 2005 7:06 am
by ahmediftikhar
Test it out urself. It will make 02:00:00