public static DateTime GetBitDateTime(string path)
{
DateTime date = new DateTime();
FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
System.Drawing.Image image = System.Drawing.Image.FromStream(stream, true, false);
System.Drawing.Imaging.PropertyItem[] ppar = image.PropertyItems;
foreach (System.Drawing.Imaging.PropertyItem p in ppar)
{
if (p.Id == 36868)
{
string strvalue = Encoding.ASCII.GetString(p.Value);
strvalue = strvalue.Substring(0, 10).Replace(":", "-");
date = Convert.ToDateTime(strvalue);
break;
}
}
return date;
}
转载于:https://www.cnblogs.com/yangxiaobin/archive/2007/11/27/974648.html