本文介绍了日期Formate在显示中更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!!





我在dd / MM / yy.for格式的网页上的文本框中输入日期示例 - 2012年8月24日



但是当页面重定向时,它显示日期为-yy / MM / dd for Exp- 12/08/24



这个问题的任何解决方案??





我的编码低于







Hi !!


I have Enter date in Text box on my webpage in formate of dd/MM/yy.for Example -- 24/08/12

But When page redirects it displays date as - yy/MM/dd for Exp- 12/08/24

Any solution for this problem ??


My coding is below



Quote:

Imports System.Data.OleDb.OleDbCommand

Imports System.Data.OleDb.OleDbConnection

进口System.Data.OleDb.OleDbDataReader

进口System.Data.OleDb

进口系统

部分班级管理员

继承System.Web.UI.Page

Dim cn As OleDbConnection

Dim cmd As OleDbCommand

Dim datastring As String

Dim cmd1 As OleDbCommand

Dim cmdstr As String

Dim FileNameStr As String

Dim FileStore作为字符串



受保护的子Page_Load(ByVal发送者作为对象,ByVal e As System.EventArgs)处理Me.Load

Dim strdate As String



如果IsPostBack = False那么

If(Session(UserName))=那么

Response.Redirect(index.aspx)

Else

Response.ClearHeaders()

Response.AddHeader(Cache-Control, No-cache,no-store,max-age = 0,must-revalidate)

Response.AddHeader(Pragma,no-cache)

结束如果

结束如果







如果FileUpload1.HasFile = True然后



strdate =(Date.Now).ToString(mmddyy)

Session.Item(strfile)= strdate



FileNameStr = TxtPdate.Text



Dim Ext As String = System.IO.Path.GetExtension(FileUpload1.FileName)



FileUpload1.SaveAs(Request.PhysicalApplicationPath& 已上传的文件\& strdate& Ext)





Lbl1.Text =文件成功上传



其他



''Lbl2.Text =没有上传的文件



结束如果









End Sub



受保护的Sub Button1_Click(ByVal sender As Object,ByVal e As System.EventArgs)处理Button1.Click







cn =新的OleDbConnection(Provider = Microsoft.Jet.Oledb.4.0; Data source =& Server.MapPath(DEO.mdb))

cn。打开()

cmd =新的OleDbCommand(选择选择格式(ParipatraDate,''dd / MM / yy'')作为GRDate,主题,来自Paripatra的文件名,cn)





Dim Ext As String = System.IO.Path.GetExtension(FileUpload1.FileName)

cmdstr =插入Paripatra (ParipatraDate,Subject,FileName)值(#& T xtPdate.Text& #,''& TxtParipatra.Text& '',''& Session.Item(strfile)& Ext& '')



cmd.CommandText = cmdstr

cmd.ExecuteNonQuery()







End Sub



受保护的Sub Button2_Click(ByVal sender As Object,ByVal e作为System.EventArgs)处理Button2.Click



Session.Clear()

Response.Redirect(index.aspx)



结束子

结束类

Imports System.Data.OleDb.OleDbCommand
Imports System.Data.OleDb.OleDbConnection
Imports System.Data.OleDb.OleDbDataReader
Imports System.Data.OleDb
Imports System
Partial Class Admin
Inherits System.Web.UI.Page
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim datastring As String
Dim cmd1 As OleDbCommand
Dim cmdstr As String
Dim FileNameStr As String
Dim FileStore As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strdate As String

If IsPostBack = False Then
If (Session("UserName")) = "" Then
Response.Redirect("index.aspx")
Else
Response.ClearHeaders()
Response.AddHeader("Cache-Control", "No-cache,no-store,max-age=0, must-revalidate")
Response.AddHeader("Pragma", "no-cache")
End If
End If



If FileUpload1.HasFile = True Then

strdate = (Date.Now).ToString("mmddyy")
Session.Item("strfile") = strdate

FileNameStr = TxtPdate.Text

Dim Ext As String = System.IO.Path.GetExtension(FileUpload1.FileName)

FileUpload1.SaveAs(Request.PhysicalApplicationPath & "Uploaded Files\" & strdate & Ext)


Lbl1.Text = "File Successfully Uploaded"

Else

''Lbl2.Text = "No Uploaded File"

End If




End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click



cn = New OleDbConnection("Provider= Microsoft.Jet.Oledb.4.0;Data source =" & Server.MapPath("DEO.mdb"))
cn.Open()
cmd = New OleDbCommand("select select format(ParipatraDate,''dd/MM/yy'')As GRDate,Subject,FileName from Paripatra", cn)


Dim Ext As String = System.IO.Path.GetExtension(FileUpload1.FileName)
cmdstr = "Insert into Paripatra (ParipatraDate,Subject,FileName)values(#" & TxtPdate.Text & "#,''" & TxtParipatra.Text & "'',''" & Session.Item("strfile") & Ext & "'')"

cmd.CommandText = cmdstr
cmd.ExecuteNonQuery()



End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

Session.Clear()
Response.Redirect("index.aspx")

End Sub
End Class

推荐答案


这篇关于日期Formate在显示中更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 02:31