簡體   English   中英

C#SSIS腳本組件格式輸入“ MMddyyyyy”的日期行

[英]C# SSIS Script Component Format Input Date Row to “MMddyyyy”

我目前正在研究轉換組件腳本。 我想將輸入日期列的格式設置為“ MMddYYYY”。

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    /*
     * Add your code here
     */

    Row.SampleDate = Convert.ToDateTime(Row.SampleDate.ToString("MM/dd/yyyy"));
    Row.TestDate = Convert.ToDateTime(Row.TestDate.ToString("MM/dd/yyyy"));
    Row.ComponentsTestDate = Convert.ToDateTime(Row.ComponentsTestDate.ToString("MM/dd/yyyy"));
}

腳本執行后,我仍然會獲得時間戳記值:

在此處輸入圖片說明

字符串具有格式。 DateTimes不

如果要查看特定格式的輸出,則需要將輸出列設置為字符串數據類型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM