当我使用此代码时,我们的日期时间会在服务器上部署后打印此(12/31/999)?而在当地工作正常 [英] When i use this code our date time print this (12/31/999) after Deploy on server ? while in local its working fine

查看:107
本文介绍了当我使用此代码时,我们的日期时间会在服务器上部署后打印此(12/31/999)?而在当地工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string allskilss = Convert.ToString(obj123.sKILLSSECTION);
                if (allskilss.Length > 2)
                {
                    try
                    {
                        string[] CountSkill = allskilss.Split(',');
                        int m = 0;
                        int n = 1;
                        if (obj123.eMPDT.Rows.Count > 0)
                        {
                            foreach (string Count in CountSkill)
                            {
                                DateTime LastUsedDate = Convert.ToDateTime(obj123.lASTUSEDDATE);
                                bool flag = false;
                                string Compare = Convert.ToString(CountSkill[m]);
                                for (int i = 0; i < obj123.eMPDT.Rows.Count; i++)
                                {
                                    string ProjectSummary = Convert.ToString(obj123.eMPDT.Rows[i][4]);
                                    string[] ProjectSummarySkill = ProjectSummary.Split(',', ':', '\n', '\t', '/',' ');                               
                                    foreach (string ProjectSummarySkillss in ProjectSummarySkill)
                                    {  
                                        if (ProjectSummarySkillss.Trim() == Compare.Trim())
                                        {
                                            if (LastUsedDate <= Convert.ToDateTime(obj123.eMPDT.Rows[i][12])) 
                                            {
                                                LastUsedDate = Convert.ToDateTime(obj123.eMPDT.Rows[i][12]);
                                                flag = true;
                                                break;
                                            }
                                        }
                                    }
                                    if ((flag) && (i == obj123.eMPDT.Rows.Count - 1))
                                    {
                                        sb.AppendLine();
                                        sb.Append("<skills_set_">                                        try
                                        {
                                            sb.Append("<lastused_date_">                                          //sb.Append("<lastused_date_">                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                                if ((!flag))
                                {
                                    if ((obj123.lASTUSEDDATE) != "1/1/0001")
                                    {
                                        sb.AppendLine();
                                        sb.Append("<skills_set_">                                        try
                                        {
                                         sb.Append("<lastused_date_">                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else
                                    {
                                        sb.AppendLine();
                                        sb.Append("<skills_set_">                                        try
                                        {
                                        sb.Append("<lastused_date_">                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                                n = n + 1;
                                m = m + 1;
                            }
                        }
                        else
                        {
                            if (allskilss != null)
                            {
                                try
                                {
                                    if ((obj123.lASTUSEDDATE) != "1/1/0001")
                                    {
                                        foreach (string Count in CountSkill)
                                        {
                                            sb.AppendLine();
                                            sb.Append("<skills_set_">                                            sb.Append("<lastused_date_">                                            n = n + 1;
                                            m = m + 1;
                                        }
                                    }
                                    else
                                    {
                                        foreach (string Count in CountSkill)
                                        {
                                            sb.AppendLine();
                                            sb.Append("<skills_set_">                                            sb.Append("<lastused_date_">                                            n = n + 1;
                                            m = m + 1;
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }

推荐答案

您已经来了一段时间,并且知道如何提出问题.
更不用说,您也对PRE标签非常熟悉,因为您已经多次被告知.
尽管多次要求您,您仍未接受一个答案(有理由这样做).您还期望这里的人帮助吗?
无论如何,我希望您有一天会开始遵循这些准则.

谈到您的问题,至少我没有阅读您在此处转储的全部代码.
我觉得这与系统上设置的Culture有关.您的系统可能具有不同的区域性,而服务器还具有其他类型.默认情况下为en.US.
您可以为页面设置特定的区域性(使用各种方法),甚至可以为整个应用程序(在web.config中)设置.

阅读: MSDN:文化信息类 [
You have been here for quite sometime and know how to ask questions.
Not to mention, you are also very well familiar with PRE tags as you have been told about it many a times.
You have not accepted a single answer despite being requested many times (with the reasons why you should do so). And you still expect help from people here?
Anyways, I hope you will start following the guidelines some day.

Coming to your question, at least I am not reading the whole code that you have dumped here.
I feel it''s related to Culture set on the system. Your system may have a different culture and the server has something else. By default it is en-US.
You can set a specific culture for a Page (using various methods) or even for the whole Application (in web.config) file.

Read: MSDN: Culture Info Class[^] for more details.

Hope this helps!


这篇关于当我使用此代码时,我们的日期时间会在服务器上部署后打印此(12/31/999)?而在当地工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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