Click here to Skip to main content
15,942,401 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:

Can anybody please tell me what will be the output for this
formatdatetime(cdate(dtaETA) - 2,2) & " 12:00 PM"

this is the code from classic asp page here "dtaETA" is the date that we are passing as variable for this

Thanks in advance

What I have tried:

formatdatetime(cdate(dtaETA) - 2,2) & " 12:00 PM"
Updated 20-Apr-16 2:22am
CHill60 20-Apr-16 8:17am    
Without knowing what is in dtaETA then we can't tell what the output (if any) would be. Why not just run it and find out?
Sergey Alexandrovich Kryukov 20-Apr-16 12:19pm    
Is it VBScript? Do you really use VBScript in .NET? But why?

1 solution

Here is the documentation for FormateDateTime, VBScript FormatDateTime Function[^].

Passing in a 2 gives you mm/dd/yy. CDate converts the value to a date. So essentially you should end up with mm/dd/yy 12:oo PM.
Share this answer
Member 12473142 20-Apr-16 8:44am    
Thanks for explaining that , by passing 2 it gives short date.
Then I have a doubt at (cdate(dtaETA) - 2,2), here -2 is also . Can you please clear this
ZurdoDev 20-Apr-16 8:58am    
CDate means Convert to Date. So, it converts whatever is in dtaETA to a date, then subtracts 2 days.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900