如果时间和日期在一个参数中,如何更改日期格式?
Parameters!DateTimeFrom.Value
我想在MM-dd-yyyy
中更改它。
请帮忙。
答案 0 :(得分:1)
你可以试试这个,
<script type="text/javascript">
function Movie(title, genre, rating, price, img) {
this.title = title;
this.genre = genre;
this.rating = rating;
this.price = price;
this.image = img;
}
// Just a better way to add methods to the objects prototype
Movie.prototype.display = function() {
document.write("<blockquote style='text-align:left; font-size:15px; font-family: Arial, sans-sherif; font-weight:600; float:left; padding-left: 20px; padding-right:40px; padding-top:40px; color:#C58917;'>Title:" + this.title + "<br>");
document.write("Genre:" + this.genre + "<br>");
document.write("Rating:" + this.rating + "<br>");
document.write("Price:" + this.price + "</blockquote><br>");
document.write("<span><IMG float:'right' SRC='" + this.image + "' style='width:138px; height:158px;'>" + "<BR><BR>");
};
var movieone = new Movie(" Avengers the age of Ultron", " Action / Adventure", " 8.0/10.0", " $9.99", "Labs_Images/Avg_Ultron.jpg");
var movietwo = new Movie(" The Age of Adaline", " Drama / Romance", " 6.7/10.0", " $8.99, ", "Labs_Images/Tmrr_land.jpg");
var moviethree = new Movie(" The Age of Adaline", " Drama / Romance", " 6.7/10.0", " $8.99", "Labs_Images/MM_road.jpg");
document.write("<br> <br>", "<h2>Next</h2>", "<br> <br>");
// Creates an array for the movies
var ArrayOfMovies = [];
// Pushes some movies
ArrayOfMovies.push(movieone);
ArrayOfMovies.push(movietwo);
ArrayOfMovies.push(moviethree);
// Pushes some movies display
var movie = ArrayOfMovies[ArrayOfMovies.length - 3];
movie.display();
var movie = ArrayOfMovies[ArrayOfMovies.length - 2];
movie.display();
var movie = ArrayOfMovies[ArrayOfMovies.length - 1];
movie.display();
document.write("<br> <br>", "<h2>Next2</h2>", "<br> <br>");
// Proper pop()
var movie = ArrayOfMovies.pop();
movie.display();
document.write("<br> <br>", "<h2>Next3</h2>", "<br> <br>");
// Proper shift()
movie = ArrayOfMovies.shift();
movie.display();
document.write("<br> <br>", "<h2>Next4</h2>", "<br> <br>");
// Proper push() and pop()
ArrayOfMovies.push(movietwo);
movie = ArrayOfMovies.pop();
movie.display();
document.write("<br> <br>", "<h2>Next5</h2>", "<br> <br>");
// Proper unshift() and shift()
ArrayOfMovies.unshift(moviethree);
movie = ArrayOfMovies.shift();
movie.display();
</script>
或者,如果您还要显示时间 - =Format(CDate(Parameters!DateTimeFrom.Value),"MM-dd-yyyy")
,那么您应该尝试以下,
MM-dd-yyyy hh:mm:ss