Split a string in ASP Javascript
-
21-09-2019 - |
Question
I am trying to split a string from a recordset that is in the format DD/MM/YYYY
.
So basically something like:
Homework.Fields.Item("DateDue").Value.split("/")
But that doesn't work, Normally I can do:
String(Homework.Fields.Item("DateDue").Value).split("/")
But using String()
turns the value into a long thing like:
Wed Oct 26 00:00:00 UTC+0100 2011
Which I can't split.
All I need is the day DD
part.
Is there away to bump topics as I still haven't got working answer.
Solution 2
Turns out I had to use client side javascript anyway, to get the clients local time. So I just put the Homework....Value into a javascript Variable and it seems to work.
OTHER TIPS
Maybe you just need to Homework.Fields.Item("DateDue").Value.getDate()
Maybe you need to parse date first from the value before calling getDate()?
DateTime.Parse(Homework.Fields.Item("DateDue").Value).getDate()?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow