alfonso
Posts: 121
|
Posted: 10/11/2011, 11:50 PM |
|
I have a data field and I want to show in grid 2 things:
1. day of the date
2. Frist 3 letters of the month
So I have created 2 labels named dia and mes. In before show I have written:
1. $noticias->dia->SetText(date('d',strtotime($noticias->fecha->GetText())));
2. $noticias->mes->SetText(ucwords(strftime("%b",strtotime($noticias->fecha->GetText()))));
The question is that, as I'm in Spain I have data in dd-mm-yyyy format. So, I recieve this values wrong:
11-08-2011 (dd-mm-yyyy): Dia=08 Month=Nov
I see the script is worng because day is the month and month is the day.
Any idea? Thanks
|
|
|
datadoit
|
Posted: 10/12/2011, 5:37 AM |
|
Alfonso, use the Properties settings for the labels. No programming
required for what you want to do. Look at that and report back.
|
|
|
alfonso
Posts: 121
|
Posted: 10/12/2011, 11:00 AM |
|
Can you be more explicit?
In properties of the label I can assign date field (fecha), but I don't know what to do
|
|
|
benjohn
Posts: 30
|
Posted: 10/12/2011, 11:39 AM |
|
Alfonso,
the label component that you dropped, click on that and check the properties. assign type as date then you could play with the format you prefer. hope this helps... all the best!
pal,
Benjohn
_________________
~=~=~=~=~=~=~=~=~=~=~=
get it done. make it happen.
~=~=~=~=~=~=~=~=~=~=~= |
|
|
alfonso
Posts: 121
|
Posted: 10/12/2011, 1:19 PM |
|
In format properties I put %d, but I get the full date, not only days number
|
|
|
benjohn
Posts: 30
|
Posted: 10/12/2011, 4:01 PM |
|
if your using mysql then try on the same property settings
Format = dd-mmm-yyyy
DBFormat = yyyy-mm-dd HH:nn:ss
but to possibly understand what you meant, you might have been referring to:
$noticias->mes->SetText(ucwords(strftime("%b",strtotime($noticias->fecha->GetText()))));
instead of %b try
date("M",,strtotime($noticias->fecha->GetText()));
then again i would prefer the first solution where you just edit the properties of the label anyhow hope this helps... all the best!
pal,
Benjohn
_________________
~=~=~=~=~=~=~=~=~=~=~=
get it done. make it happen.
~=~=~=~=~=~=~=~=~=~=~= |
|
|
alfonso
Posts: 121
|
Posted: 10/13/2011, 3:41 AM |
|
I have got to get day and month. Thanks
In format I put mmmm and get the full name of the month
Now in {mes} appears the month "octubre". I want to get "Oct"
Thanks
|
|
|
benjohn
Posts: 30
|
Posted: 10/13/2011, 7:11 PM |
|
if your using the label properties i think mmm would work. hope this helps... all the best!
pal,
Benjohn
_________________
~=~=~=~=~=~=~=~=~=~=~=
get it done. make it happen.
~=~=~=~=~=~=~=~=~=~=~= |
|
|
|