Two-digit year formatting

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Two-digit year formatting

Tom Parker-15
In the following example, where (Field:'LMP') = 6/1/2007, the result is
3/08/2008, which is correct.  However, if I change the %Y to %y, the result
is 3/08/8 (instead of 3/08/08).  Is that proper behavior for %y to display
the year as a single digit number?

Example (I'm including this in case there is something weird about my code
that is causing %y to display strangely--this is calculating a date roughly
nine months in the future based on a known date):

 [If:(Date_Format: (Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')<4]

  <td class="rounds">[Math_Add:(Date_Format: (Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m'),9]/[(Date_Format:
(Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%d')]/[(Date_Format:
(Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%Y')]</td>

 [Else:(Date_Format: (Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')>3]

  <td class="rounds">[Math_Sub:(Date_Format: (Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m'),3]/[(Date_Format:
(Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%d')]/[Math_Add:(Date_Format:
(Date_Add: (Date_Format: (Date:
(Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%Y'),1]</td>

 [/If]

Also: from the live reference database,
http://reference.lassosoft.com/Reference.LassoApp?[Date], the documentation
says:

"%D U.S. date format (mm/dd/yy)."

However, %D always returns mm/dd/yyyy.

Are there any shortcuts to properly display a 2-digit year?  I have a screen
that needs all the space I can squeeze out of it, so I need to compress
years to two digits.

Thanks,

--Tom



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Two-digit year formatting

Jolle Carlestam-2
I think the culprit is that you use Math-add. That will result in an  
integer stripping the 0 from the result.

And I must say that your formula seems rather long for it's purpose.  
Do you want to add nine months to the date?

HDB
Jolle

6 aug 2007 kl. 22.02 skrev Tom Parker:

> In the following example, where (Field:'LMP') = 6/1/2007, the  
> result is 3/08/2008, which is correct.  However, if I change the %Y  
> to %y, the result is 3/08/8 (instead of 3/08/08).  Is that proper  
> behavior for %y to display the year as a single digit number?
>
> Example (I'm including this in case there is something weird about  
> my code that is causing %y to display strangely--this is  
> calculating a date roughly nine months in the future based on a  
> known date):
>
> [If:(Date_Format: (Date_Add: (Date_Format: (Date: (Field:'LMP'), -
> Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')<4]
>
>  <td class="rounds">[Math_Add:(Date_Format: (Date_Add:  
> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
> Week=1),-DateFormat='%m'),9]/[(Date_Format: (Date_Add:  
> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
> Week=1),-DateFormat='%d')]/[(Date_Format: (Date_Add: (Date_Format:  
> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-
> DateFormat='%Y')]</td>
>
> [Else:(Date_Format: (Date_Add: (Date_Format: (Date: (Field:'LMP'), -
> Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')>3]
>
>  <td class="rounds">[Math_Sub:(Date_Format: (Date_Add:  
> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
> Week=1),-DateFormat='%m'),3]/[(Date_Format: (Date_Add:  
> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
> Week=1),-DateFormat='%d')]/[Math_Add:(Date_Format: (Date_Add:  
> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
> Week=1),-DateFormat='%Y'),1]</td>
>
> [/If]
>
> Also: from the live reference database, http://
> reference.lassosoft.com/Reference.LassoApp?[Date], the  
> documentation says:
>
> "%D U.S. date format (mm/dd/yy)."
>
> However, %D always returns mm/dd/yyyy.
>
> Are there any shortcuts to properly display a 2-digit year?  I have  
> a screen that needs all the space I can squeeze out of it, so I  
> need to compress years to two digits.
>
> Thanks,
>
> --Tom
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Two-digit year formatting

Jolle Carlestam-2
If I wanted to add nine months to a date I would write it like this:

[(Date_Add: date, -Month=9)->(format:'%m/%d/%y')]

And if the date came from a field:

[(Date_Add: (Date: (Field:'LMP'), -Format='%Q'), -Month=9)->(format:'%
m/%d/%y')]
(The last one untested)

HDB
Jolle

6 aug 2007 kl. 22.16 skrev Jolle Carlestam:

> I think the culprit is that you use Math-add. That will result in  
> an integer stripping the 0 from the result.
>
> And I must say that your formula seems rather long for it's  
> purpose. Do you want to add nine months to the date?
>
> HDB
> Jolle
>
> 6 aug 2007 kl. 22.02 skrev Tom Parker:
>
>> In the following example, where (Field:'LMP') = 6/1/2007, the  
>> result is 3/08/2008, which is correct.  However, if I change the %
>> Y to %y, the result is 3/08/8 (instead of 3/08/08).  Is that  
>> proper behavior for %y to display the year as a single digit number?
>>
>> Example (I'm including this in case there is something weird about  
>> my code that is causing %y to display strangely--this is  
>> calculating a date roughly nine months in the future based on a  
>> known date):
>>
>> [If:(Date_Format: (Date_Add: (Date_Format: (Date: (Field:'LMP'), -
>> Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')<4]
>>
>>  <td class="rounds">[Math_Add:(Date_Format: (Date_Add:  
>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>> Week=1),-DateFormat='%m'),9]/[(Date_Format: (Date_Add:  
>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>> Week=1),-DateFormat='%d')]/[(Date_Format: (Date_Add: (Date_Format:  
>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-
>> DateFormat='%Y')]</td>
>>
>> [Else:(Date_Format: (Date_Add: (Date_Format: (Date: (Field:'LMP'),  
>> -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')>3]
>>
>>  <td class="rounds">[Math_Sub:(Date_Format: (Date_Add:  
>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>> Week=1),-DateFormat='%m'),3]/[(Date_Format: (Date_Add:  
>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>> Week=1),-DateFormat='%d')]/[Math_Add:(Date_Format: (Date_Add:  
>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>> Week=1),-DateFormat='%Y'),1]</td>
>>
>> [/If]
>>
>> Also: from the live reference database, http://
>> reference.lassosoft.com/Reference.LassoApp?[Date], the  
>> documentation says:
>>
>> "%D U.S. date format (mm/dd/yy)."
>>
>> However, %D always returns mm/dd/yyyy.
>>
>> Are there any shortcuts to properly display a 2-digit year?  I  
>> have a screen that needs all the space I can squeeze out of it, so  
>> I need to compress years to two digits.
>>
>> Thanks,
>>
>> --Tom
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Two-digit year formatting

Tom Parker-15
In reply to this post by Tom Parker-15
Thanks.  The formatting works as expected now.  And, yes, that was a long
route to add nine months--I think it devolved from a more complicated
calculation at one point.

--Tom

----- Original Message -----
From: "Jolle Carlestam" <[hidden email]>
To: "Lasso Talk" <[hidden email]>
Sent: Monday, August 06, 2007 2:22 PM
Subject: Re: Two-digit year formatting


> If I wanted to add nine months to a date I would write it like this:
>
> [(Date_Add: date, -Month=9)->(format:'%m/%d/%y')]
>
> And if the date came from a field:
>
> [(Date_Add: (Date: (Field:'LMP'), -Format='%Q'), -Month=9)->(format:'%
> m/%d/%y')]
> (The last one untested)
>
> HDB
> Jolle
>
> 6 aug 2007 kl. 22.16 skrev Jolle Carlestam:
>
>> I think the culprit is that you use Math-add. That will result in  an
>> integer stripping the 0 from the result.
>>
>> And I must say that your formula seems rather long for it's  purpose. Do
>> you want to add nine months to the date?
>>
>> HDB
>> Jolle
>>
>> 6 aug 2007 kl. 22.02 skrev Tom Parker:
>>
>>> In the following example, where (Field:'LMP') = 6/1/2007, the  result is
>>> 3/08/2008, which is correct.  However, if I change the % Y to %y, the
>>> result is 3/08/8 (instead of 3/08/08).  Is that  proper behavior for %y
>>> to display the year as a single digit number?
>>>
>>> Example (I'm including this in case there is something weird about  my
>>> code that is causing %y to display strangely--this is  calculating a
>>> date roughly nine months in the future based on a  known date):
>>>
>>> [If:(Date_Format: (Date_Add: (Date_Format: (Date: (Field:'LMP'), -
>>> Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')<4]
>>>
>>>  <td class="rounds">[Math_Add:(Date_Format: (Date_Add:  (Date_Format:
>>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>>> Week=1),-DateFormat='%m'),9]/[(Date_Format: (Date_Add:  (Date_Format:
>>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>>> Week=1),-DateFormat='%d')]/[(Date_Format: (Date_Add: (Date_Format:
>>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -Week=1),-
>>> DateFormat='%Y')]</td>
>>>
>>> [Else:(Date_Format: (Date_Add: (Date_Format: (Date:
>>> Field:'LMP'),  -Format='%Q'), -Format='%D'), -Week=1),-DateFormat='%m')>3]
>>>
>>>  <td class="rounds">[Math_Sub:(Date_Format: (Date_Add:  (Date_Format:
>>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>>> Week=1),-DateFormat='%m'),3]/[(Date_Format: (Date_Add:  (Date_Format:
>>> (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>>> Week=1),-DateFormat='%d')]/[Math_Add:(Date_Format: (Date_Add:
>>> (Date_Format: (Date: (Field:'LMP'), -Format='%Q'), -Format='%D'), -
>>> Week=1),-DateFormat='%Y'),1]</td>
>>>
>>> [/If]
>>>
>>> Also: from the live reference database, http://
>>> reference.lassosoft.com/Reference.LassoApp?[Date], the  documentation
>>> says:
>>>
>>> "%D U.S. date format (mm/dd/yy)."
>>>
>>> However, %D always returns mm/dd/yyyy.
>>>
>>> Are there any shortcuts to properly display a 2-digit year?  I  have a
>>> screen that needs all the space I can squeeze out of it, so  I need to
>>> compress years to two digits.
>>>
>>> Thanks,
>>>
>>> --Tom
>>>
>>>
>>> --
>>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>>
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/