如何在Acumatica中将日期时间解释为用户的本地时区 [英] How to interpret datetime as User's local timezone in Acumatica

查看:43
本文介绍了如何在Acumatica中将日期时间解释为用户的本地时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个开始按钮,将dateStarted字段填充到DateTime.Now ..

We have a button "Start" that populates the dateStarted field to DateTime.Now..

检索日期时间时,它始终显示服务器的日期/时间而不是用户的本地时区版本。我如何使它像lastModifiedDateTime / CreatedDateTime一样工作,每当我们查看它时,它都将格式化为用户的本地时区。我尝试了UseTimeZone = true / false,但是没有任何作用

When retrieving datetime, it always shows the server's date/time instead of user's local timezone version. How do i make it work like lastModifiedDateTime/CreatedDateTime that whenever we view it it's formatted as user's local timezone. I tried UseTimeZone = true/false but nothing is working

这是我的代码不起作用

#region DateStarted
    public abstract class dateStarted : PX.Data.IBqlField
    {
    }
    protected DateTime? _DateStarted;
    [PXDBDateAndTime(DisplayNameDate = "Date Started", DisplayNameTime = "Time", UseTimeZone = true)]

    public virtual DateTime? DateStarted
    {
        get
        {
            return this._DateStarted;
        }
        set
        {
            this._DateStarted = value;
        }
    }
    #endregion


推荐答案

听起来像只使用 PX.Common.PXTimeZoneInfo.Now 即可完成工作。

It sounds like just using PX.Common.PXTimeZoneInfo.Now is enough to do the job.

PX.Common.PXTimeZoneInfo 也有 UtcNow UtcToday Today (如果需要)

PX.Common.PXTimeZoneInfo also has UtcNow, UtcToday, and Today if needed

这篇关于如何在Acumatica中将日期时间解释为用户的本地时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆