Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Umbraco 8 DateTime picker.
I am trying to render the only date. but it is showing the time as well.
Anybody, could you please tell me how to do DateTime formatting with format specifier. so that I can render DateTime as per my requirement.
It's C# so just format the date or use the tostring format.
https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1
in Razor you might need to use some brackets e.g.
@(Model.MyDateField.ToString("dddd, dd MMMM yyyy"))
In my case i am not using models builder
foreach(var post in posts) { @post.Value("postedDate") }
Hi rajesh,
No need to use model builder, it's a c# related stuff,that is steve writes here ;)
foreach(var post in posts) {
@post.Value("postedDate").ToString("dddd, dd MMMM yyyy"));
}
Regards Dhanesh;)
Hi,
As I said in my post:
@(post.Value("postDate").ToString("dddd, dd MMMM yyyy"))
Razor can be started with just an '@' but if you have complicated snippets with multiple lots of brackets and dots it gets confused. So start with @(xxxx ) and then everything in the brackets is treated as c#.
HTH.
Steve
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Umbraco 8 DateTime Picker
Umbraco 8 DateTime picker.
I am trying to render the only date. but it is showing the time as well.
Anybody, could you please tell me how to do DateTime formatting with format specifier. so that I can render DateTime as per my requirement.
It's C# so just format the date or use the tostring format.
https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1
in Razor you might need to use some brackets e.g.
In my case i am not using models builder
Hi rajesh,
No need to use model builder, it's a c# related stuff,that is steve writes here ;)
foreach(var post in posts) {
@post.Value("postedDate").ToString("dddd, dd MMMM yyyy"));
}
Regards Dhanesh;)
Hi,
As I said in my post:
in Razor you might need to use some brackets e.g.
Razor can be started with just an '@' but if you have complicated snippets with multiple lots of brackets and dots it gets confused. So start with @(xxxx ) and then everything in the brackets is treated as c#.
HTH.
Steve
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.