Beispiel #1
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Optimised localisation where the timezone offset is known and can be utilised for multiple entries
        ///     e.g. the search and export functions...
        ///     Note that this always returns true!
        ///     Returns the local date formulated in a pretty string ...
        /// </summary>
        public static string Localise(int timezoneOffset, DateTime utcDT)
        {
            DateTime localDT = Localise(utcDT, timezoneOffset);

            string prettyLocalDate = DateTimeInformation.PrettyDateTimeFormat(localDT, timezoneOffset);

            return(prettyLocalDate);
        }
Beispiel #2
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     localisationOption can be 1=System default (normally UTC), 2=Frontend default, 3=User last login / access,
        ///     DEPRECATED - 4 - DEPRECATED=current login credentials
        ///     If 3 is not available, will default to 2; if 2 not available, will default to 1
        ///     4 is only really relevant in a couple of special cases, the PasswordResetRequest and the PasswordReset, as the user does
        ///     not actually login to complete these.  We now handle the collection of this information in these two pages, if it differs from
        ///     previous information.
        /// </summary>
        public static bool Localise(ConfigurationInfo ci, DateTime utcDT, int localisationOption, int userID, out string prettyLocalDate)
        {
            bool success = false;

            prettyLocalDate = "";
            DateTime localDT = utcDT;

            success = Localise(ci, utcDT, localisationOption, userID, out localDT);

            // have to get the difference between the utcDT and the localDT so that we can generate the pretty version ...
            if (success == true)
            {
                TimeSpan t1           = utcDT.Subtract(localDT);
                int      totalMinutes = (int)Math.Round(t1.TotalMinutes);
                prettyLocalDate = DateTimeInformation.PrettyDateTimeFormat(localDT, totalMinutes);
            }


            return(success);
        }