首页 > 解决方案 > 显示当前时间 - 小时和分钟

问题描述

我想在显示屏上显示当前时间(小时和分钟)。就性能而言,我怎样才能最有效地做到这一点。我正在使用这种技术来解决我的问题。请帮我

检查我的图像

   time: function (data: any) {
        debugger

        console.log(`Now`);

        // formatDate(date: any, format: string): string { return moment.utc(date.toString()).local().format(format); }

        return {
         field: '<input  class="form-control" type="time" value="13:30"/>',
          // field: '<input class="form-control" type="datetime" #RequiredByDate name="RequiredByDate" [value]="formatDate(hitchRequest.requiredByDate)">',
        };

标签: angulartypescript

解决方案


我不知道你所说的三列是什么意思。我像这样改变了你的内部网格

<Grid  Padding="10" RowSpacing="10">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="50" />
        <RowDefinition Height="50" />
        <RowDefinition Height="50" />
        <RowDefinition Height="50" />
    </Grid.RowDefinitions>


    <StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label Text="ID Type" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblIdType" Text="NIC"  FontSize="Small" TextColor="black"  HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="0" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="ID Number" FontSize="Small" TextColor="#757575"  HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblIdNumber" Text="65125457V"  FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="0" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label   x:Name="lblIdNumberNew" Text="ID Number(New)" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand" />
        <Label x:Name="genrealsectionforreadonlylblOldNic" Text="15665544" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="Title" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblTitle" Text="MS" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="1" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="First name" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblFname" Text="TEST"   FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="1" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="Last name" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblLname" Text="TEST1" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="2" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label Text="Gender" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblGender" Text="F" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="2" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  x:Name="genrealsectionforreadonlylblDobSelector" Text="Date of birth" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblDob" Text="5/11/1900" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="2" Grid.Column="2" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="Language" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlylblLang" Text="ENG"  FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="3" Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label  Text="Nationality" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="lblNationality" Text="LKA" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand" />
    </StackLayout>
    <StackLayout Grid.Row="3" Grid.Column="1" HorizontalOptions="FillAndExpand" Orientation="Vertical">
        <Label Text="Postal Code" FontSize="Small" TextColor="#757575" HorizontalOptions="CenterAndExpand"/>
        <Label x:Name="genrealsectionforreadonlyPcode" Text="DEFAULT" FontSize="Small" TextColor="Black" HorizontalOptions="CenterAndExpand"/>
    </StackLayout>
</Grid>

我得到了这样的东西。 结果截图


推荐阅读