TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jieha Lee
1.6k
186
9k
How to change date in dd/MMM/yyyy and time in hh:mm tt
Feb 1 2018 10:56 PM
How to change date from dd/mm/yyyy to dd/MMM/yyyy and hh:mm to hh:mm tt?
The <%=time.START_TIME%> is from the database which is store as 24H
I got error in code. the error is CS0103: The name 'date' does not exist in the current context
Here is the code:
<%
if
(obj.DATE.Substring(4, 2) ==
"01"
){
var
date = obj.DATE.Substring(6, 2) +
" Jan "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"02"
){
var
date = obj.DATE.Substring(6, 2) +
" Feb "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"03"
){
var
date = obj.DATE.Substring(6, 2) +
" Mar "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"04"
){
var
date = obj.DATE.Substring(6, 2) +
" Apr "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"05"
){
var
date = obj.DATE.Substring(6, 2) +
" May "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"06"
){
var
date = obj.DATE.Substring(6, 2) +
" June "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"07"
){
var
date = obj.DATE.Substring(6, 2) +
" July "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"08"
){
var
date = obj.DATE.Substring(6, 2) +
" Aug "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"09"
){
var
date = obj.DATE.Substring(6, 2) +
" Sept "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"10"
){
var
date = obj.DATE.Substring(6, 2) +
" Oct "
+ obj.DATE.Substring(0, 4);
}
else
if
(obj.DATE.Substring(4, 2) ==
"11"
){
var
date = obj.DATE.Substring(6, 2) +
" Nov "
+ obj.DATE.Substring(0, 4);
}
else
{
var
date = obj.DATE.Substring(6, 2) +
" Dec "
+ obj.DATE.Substring(0, 4);
}
%>
<body>
<tr>
<td colspan=
"2"
rowspan=
"2"
bordercolor=
"#0066CC"
style=
"border:2px solid #CCC; border-radius:20px; background:#CCC; font-family: tahoma;"
><h2 align=
"center"
style=
"font-family: sans-serif; font-size:calc(24px); padding:5px;"
>Your appointment is confirmed on:</h2>
<h1 align=
"center"
><strong style=
"font-family: tahoma; font-size:27px;"
><%=date %> </strong> at <strong style=
"font-family:tahoma; font-size:27px;"
><%=time.START_TIME%></strong></h1></td>
</tr>
</body>
Thanks
Reply
Answers (
2
)
ASP.NET MVC Modal Lookup
Getting files are being used by other process while playing