Class ConvertDateTimeToFileNamePrefix
- Namespace
- SunamoDateTime.Converters
- Assembly
- SunamoDateTime.dll
Converts DateTime to filename with prefix. EN: Formats DateTime as filename with custom prefix prepended. Sister class to ConvertDateTimeToFileNamePostfix. CZ: Formátuje DateTime jako název souboru s připojeným vlastním prefixem. Sesterská třída k ConvertDateTimeToFileNamePostfix.
public class ConvertDateTimeToFileNamePrefix
- Inheritance
-
ConvertDateTimeToFileNamePrefix
- Inherited Members
- Extension Methods
Methods
FromConvention(string, bool)
Parses DateTime from filename, ignoring the prefix. EN: Use DTHelper.FileNameToDateTimePrefix if you need to extract the prefix too. CZ: Použijte DTHelper.FileNameToDateTimePrefix pokud potřebujete také extrahovat prefix.
public static DateTime? FromConvention(string fileNameWithoutExtension, bool includeTime)
Parameters
fileNameWithoutExtensionstringFilename without extension to parse
includeTimeboolTrue if filename includes time component
Returns
- DateTime?
Parsed DateTime or null if parsing fails
ToConvention(string, DateTime, bool)
Converts DateTime to filename format with prefix. EN: Creates filename in format: [prefix][DateTime]. If prefix contains delimiter (), it won't be replaced. CZ: Vytvoří název souboru ve formátu: [prefix][DateTime]. Pokud prefix obsahuje delimiter (), nebude nahrazen.
public static string ToConvention(string prefix, DateTime dateTime, bool includeTime)
Parameters
prefixstringThe prefix to prepend before DateTime
dateTimeDateTimeThe DateTime to convert
includeTimeboolTrue to include time component in filename
Returns
- string
Formatted filename string