Dreamweaver
Well-known member
- Local time
- Today, 14:48
- Joined
- Nov 28, 2005
- Messages
- 2,467
I have been struggling with this for hours and after trying a number of functions from the web which wouldn't give me the correct answer I went back to basics
To find out if the time part of a date is a real time use this function
Now the key is to convert the time part of the date into a string like
DT is the date/Time value
IsTime(CStr(Format(DT, "Short Time")))
Some history
I have built an import engine that has to format a file name which can be like
As you can see all except the last file name can convert to a date and all except the 20140305 a time.
what my engine does is if the filename doesn't contain a name it gets the date and time created from the file properties I can't get to the date taken maybe somebody will know how without using another program.
D= Return from file properties function which returns the date/time created
DT= Return from the file name format conversion
so the test for date and time looks like
To find out if the time part of a date is a real time use this function
Code:
Public Function IsTime(dat As String) As Boolean
IsTime = Left(dat, 2) <> "00"
End Function
DT is the date/Time value
IsTime(CStr(Format(DT, "Short Time")))
Some history
I have built an import engine that has to format a file name which can be like
Code:
2014-09-08 18.16.11
20140108_235915
20140131_211803(1)
IMG_20130916_155007
20140305
Come into my world
what my engine does is if the filename doesn't contain a name it gets the date and time created from the file properties I can't get to the date taken maybe somebody will know how without using another program.
D= Return from file properties function which returns the date/time created
DT= Return from the file name format conversion
so the test for date and time looks like
Code:
If year(DT) > 1900 Then
!DateTaken = Format(DT, "Short Date")
Else
!DateTaken = Format(D, "Short Date")
End If
If IsTime(CStr(Format(DT, "Short Time"))) Then
!TimeTaken = Format(DT, "Short Time")
Else
!TimeTaken = Format(D, "Short Time")
End If