How to display time format in Lotus Notes

346360 pts.
Tags:
Lotus Notes
Lotus Notes Formulas
I currently have a computed field that is serving as a "reference number" that combines the date and time. Here's where the problem lies: The time format. It keeps playing AM / PM but I need it in either military time or 24 hour format. What's the formula for this? Here's my code so far:
REM {Variable Assignment};
cType := RequestType;
cDate := @Text(@Created; "D0S0");
cTime := @Text(@Now; "T0S1");

REM {Get the list of synonyms from the svType view};
cView := "svKeywordType";
clist := @DbColumn("": ""; @DbName; cView; 2);
@If((@IsError(clist) | clist = ""); "There is no request type in this system."; clist);

REM {Get the request type description list};
cDesclist := @Left(clist; " | ");

REM {Get the request type synonym list};
cSynonymlist := @Right(clist; " | ");

REM {Check the position of the request type from the list};
cPos := @Member(cType; cDesclist);

REM {Given the position, get the request type description};
cSynonym := @Subset(@Subset(cSynonymlist; cPos); -1);

REM {Get the mm value};
cMonth := @Left(cDate; "/");
REM {Get the dd value};
cDay := @Left(@Right(cDate; "/"); "/");
REM {Get the yyyy value};
cYear := @Right(@Right(cDate; "/"); "/");
cHour := @Left(cTime; ":");
cMinute := @Left(@Right(cTime; ":"); ":");
cSecond := @Right(@Right(cTime; ":"); ":");

cdateToday := @Text(@Today; "D0S0");
ctimeToday := @Text(@Now; "T0S1");

cRef := cSynonym + "-" + cMonth + cDay + cYear + "-" + cHour + cMinute + cSecond;
@If(cType = "" | @IsError(cSynonym); ""; cRef)
Appreciate the help.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Looks like you already got an answer to this on stackoverflow.

 

BTW, for future coding, you may want to look at the functions @RightBack, @Middle, @MiddleBack, and @LeftBack.  Would save you coding things like multiple @Right calls.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • shivasanjay
    I think we can make use of formula @contains(time;"PM"); i.e if we find the string 'PM' in time format then we need to add 12 to the time value to get it display in  24 hrs format.
    2,510 pointsBadges:
    report
  • shivasanjay
    for e.g. @created can be displayed as: ( I have included seconds too which can be ommitted):

    var1:=@Text(@Created;d3t1);
    x:=@Right(var1;11);
    y:=@Left(x;2);
    z:=@middle(x;3;2);
    z1:=@Middle(x;6;2);
    @If(@Contains(var1;"PM"); @LeftBack(var1;12)+" "+@Text(@ToNumber(y)+12)+":"+z+":"+z1;var1);

    2,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following