I've got an Umbraco 4.11.10 site which has a razor script to list out some documents from a particular media folder. It outputs the umbracoFile, name and umbracoBytes for every file correctly but the CreateDateTime is empty for every document. UpdateDate shows the last modified date but obviously this isn't the date I need.
Does anybody have any ideas or is there another way I can get the created date for each media item?
I don't think a DynamicMedia instance contains a property called CreateDateTime. I've checked Umbraco's source and there is one called CreateDate. Could you try using that?
Thanks for the help. I've tried that code but the dates all come out as 01-01-0001. It's like the creation date is always empty although there is one in the back office.
Perhaps it helps, if you re-build the Examine indexes. You will find on the examine indexes, if you go to the developer section, in the right top of the dashbord, in a tab called examine management.
Hope this can help you get the right date back on your images.
Empty CreateDateTime in a Macro Script
Hi,
I've got an Umbraco 4.11.10 site which has a razor script to list out some documents from a particular media folder. It outputs the umbracoFile, name and umbracoBytes for every file correctly but the CreateDateTime is empty for every document. UpdateDate shows the last modified date but obviously this isn't the date I need.
Does anybody have any ideas or is there another way I can get the created date for each media item?
Here is my script:
Hi RIchard,
I don't think a
DynamicMedia
instance contains a property calledCreateDateTime
. I've checked Umbraco's source and there is one calledCreateDate
. Could you try using that?I hope that helps.
Thanks, Dan.
Hi Dan,
Thanks for the help. I tried CreateDate but everything came out as 1/1/0001 12:00:00 AM.
Hi Richard,
What if you do something like this would you then get the date outputted in the right format.
Here are some documentation on the different parameters https://our.umbraco.org/wiki/reference/umbracolibrary/formatdatetime
Hope this helps,
/Dennis
Hi Dennis,
Thanks for the help. I've tried that code but the dates all come out as 01-01-0001. It's like the creation date is always empty although there is one in the back office.
Hi Richard,
Perhaps it helps, if you re-build the Examine indexes. You will find on the examine indexes, if you go to the developer section, in the right top of the dashbord, in a tab called examine management.
Hope this can help you get the right date back on your images.
/Dennis
Hi,
I didn't have that option available so I installed Examine Dashboard and rebuilt the indexes but unfortunately that has made no difference.
is working on a reply...