Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Timestamp in strings

$
0
0

Dears,

I have a Label inside listview-viewcell, to show time in UI. The date is received as a number like 1510822596449 (Java timestamp). I want to show the date in strings like "n days ago". How can I achieve this?

<StackLayout>
    <ListView>
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                <StackLayout>
                    <Label Text="{Binding createdTime}"/>
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
</StackLayout>

I try IValueConverter in the following link, but it is not working.
https://stackoverflow.com/questions/32814176/how-to-format-date-and-time-in-xaml-in-xamarin-application

Anybody, please suggest a solution with working code. Thanks in advance.


Viewing all articles
Browse latest Browse all 204402

Trending Articles