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
Nishanth J
NA
855
13.8k
Replacing the String having Date and Time with = and ""
Mar 30 2020 8:29 AM
Whenever writing the date-and-time to an excel sheet the default cell format treats it as date and time and display in the format dd/mm/yyyy hh:mm, rather than displaying as dd-MMM-yyyy HH:mm:ss
But coming back to an Excel Sheet, whenever the date and time is enclosed with " "(double quotes) and prefixed with =(equals sign), it treats it as a string holding some values and displays exactly as it is rather than displaying default dd/mm/yyyy hh:mm format.
So as per the requirement, to achieve the string containing table data having dd/mm/yyyy hh:mm format need's to replace the date and time enclosed with double quotes with ="dd-MMM-yyyy HH:mm:ss"
Eg: 25-Feb-2020 15:27:58 need to be replaced with ="25-Feb-2020 15:27:58"
<table>
\n
<thead>
<tr>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>Login Name</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner sortable\"
>Registered</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>Registered Date <br>Time</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner sortable\"
>User Response Count</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>Test Start Date Time</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>Test End Date Time</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>Time Remaining</div>
<div
class
=\
"fht-cell\"
></div>
</th>
<th style=\
"\"
>
<div
class
=\
"th-inner \"
>User Status</div>
<div
class
=\
"fht-cell\"
></div>
</th>
</tr>
</thead>
<tbody>
<tr data-index=\
"9\"
>
<td style=\
"\"
>njuser14</td>
<td style=\
"\"
>Yes</td>
<td style=\
"\"
>-</td>
<td style=\
"\"
>0</td>
<td style=\
"\"
>25-Feb-2020 15:27:58</td>
<td style=\
"\"
>25-Feb-2020 15:28:03</td>
<td style=\
"\"
>179</td>
<td style=\
"\"
>Paused</td>
</tr>
<tr data-index=\
"10\"
>
<td style=\
"\"
>njuser15</td>
<td style=\
"\"
>Yes</td>
<td style=\
"\"
>-</td>
<td style=\
"\"
>0</td>
<td style=\
"\"
>25-Feb-2020 15:27:32</td>
<td style=\
"\"
>25-Feb-2020 15:27:42</td>
<td style=\
"\"
>179</td>
<td style=\
"\"
>Paused</td>
</tr>
</tbody>
</table>
In the below coding snippets BatchDetails holding string containing table data, needs to be replaced and later assigned into session
[System.Web.Services.WebMethod()]
public
static
string
PersistBatchDetails(
object
BatchDetails)
{
try
{
HttpContext.Current.Session[
"DashboardBatchInfo"
] = BatchDetails;
}
catch
(Exception ex){}
return
"S001"
;
}
Reply
Answers (
2
)
how to use multiple form tag in asp.net
Datetime in a model not working