What is the easiest way to flip a date using Lotus Script?
I have a date that is brought in from a database file in decimal format 20051027. I want to display it as 10272005.
I tried the method of multiplying it by 10000.0001 but get the result of 200510272005.001.
Subject: Flipping a date
Don’t know if this is the best method - but this is what I use to do something similar.
CCYY := @Right ( @Text ( CNIEarliestPriorityDate ) ;4 ) ;
MM := @Middle ( @Text ( CNIEarliestPriorityDate ) ;3;2 ) ;
DD := @Left ( @Text ( CNIEarliestPriorityDate ) ;2 ) ;
CCYYMMDD := CCYY + MM + DD ;
@TextToNumber (CCYYMMDD)
Hope that helps,
Phill
Subject: Flipping a date
It doesn’t exactly answer your question, but the best (as opposed to easiest) idea is to convert it into a date format, and then that date format can be respresented different ways depending on your needs.
The easiest approach is probably in formula language:
decdate = 20051027
strtmp = @Text (decdate)
@Middle (strtmp; 5; 4)+@Left(strtmp; 4)
Subject: Flipping a date
Uh he did say he wanted Lotus Script
strDate = “20051027”
strYear = Left(strDate, 4)
strMonth = Mid(strDate, 5, 2)
strDay = Right(strDate,2)
’ You may have to flip the order of the month and year depending on your regional settings
objNotesDateTime = New NotesDateTime(strMonth & “/” & strDay & “/” & strYear)
strFinalDate = Format(objNotesDateTime, “Format string”)
hcl-bot
October 28, 2005, 10:31am
6
Subject: RE: Flipping a date
Thanks a million! That’s exactly what I needed!