Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format from second to date

Status
Not open for further replies.

aishaaa

Programmer
May 1, 2002
21
0
0
AE
i have a proplem all the date fields in the database are stored in seconds so, i will need a formula field in SCR to get it to date format. Formula is as below

NumberVar TimeChange :=-5;

NumberVar SecPerday :=86400;

NumberVar SecPerHr :=3600;

({CALL_REQ.CLOSE_DATE} + (Timechange * SecPerHr))/SecPerDay + DateTime (1970,1,1,11,00,00);


but it's not working .. can u help me please

Aisha
 
Hey Aisha,

I'm not really sure what your TimeChange variable is designed to achieve, but the way I convert seconds to time is like this:

WhilePrintingRecords;
NumberVar Hours;
NumberVar Mins;
NumberVar Secs;

Hours := Truncate({Table.SecondsDate}/3600)
Mins := Truncate((({Table.SecondsDate}/3600) - Hours)*60)
Secs := Truncate((((({Table.SecondsDate}/3600) - Hours)*60) - Mins)*60)

ToText(Time(Hours,Mins,Secs),"hh:mm:ss")

I hope this puts you on the road to where you want to go, but if not, give me a shout.

Naith
 
thanks for ur help i will check it and let u know if it's working fine
 

hi
i have tried it but am getting error .. "the remming text dose not appear to be part of formula" .. can u please help me

Thanks in advance
 
Whoops. My bad. There should be ; at the end of each Hours, Mins, Secs line.

Hours := Truncate({Table.SecondsDate}/3600);
Mins := Truncate((({Table.SecondsDate}/3600) - Hours)*60);
Secs := Truncate((((({Table.SecondsDate}/3600) - Hours)*60) - Mins)*60);


Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top