Answer the question
In order to leave comments, you need to log in
How to change date format in C#?
using System;
using System.Collections.Generic;
using System.Text;
using DynamicPluginData;
namespace DatacolDynamicPluginNS
{
public class DynamicPluginClass
{
public static string processDataFieldValue(string s, ItemInfo itemInfo, GlobalInfo globalInfo)
{
return s;
}
}
}
Answer the question
In order to leave comments, you need to log in
var date = DateTime.Now;
Console.WriteLine(date.ToString("yyyy-MM-dd"));
s
you have type string
, so you must first cast it
to DateTime
:DateTime date;
var result = DateTime.TryParse(s, out date);
if(result)
{
var dateFormat = date.ToString("нужный формат");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question