how can I make datetime format with variables ms access - datetime

I like to pass datatime to a function but can't format it with variables.
I like to call a function with datatime like this.
function(#Me.frmDate/Me.frmMonth/Me.frmYear#).
But as you know, this code can't be compiled.
I would like to know correct code.
Thanks

You can call your function, which has Date/Time data type parameter like this:
function(DateSerial(Me.frmYear, Me.frmMonth, Me.frmDate))
Here Me.frm* fields should contain valid numbers for desired date

Related

Setting sas date to yymmdd8 as a character variable

Putting on my dunce cap because I'm sure the answer will be simple but for the life if me I can't get this to work. I need to convert the numeric date to display as follows "20200412" to try and match between another data set.
I've tried this:
Newdate=put (old date, yymmdd8.); and it just makes new date display as blank.
Thanks for any help.
Just use newDate=input(oldDate, YYMMDDN.); instead.
data test;
oldDate="20220412";
format newDate YYMMDDN.;
newDate=input(oldDate, YYMMDDN.);
run;
This format is what you want.

Number format with Eval in ASP.NET

I would like to format this kind of number:
1234567.99 (obviously all thousands digits are optional)
In this way: 1.234.567,99
I know it is possible with Eval, but I didn't find an useful guide to do this.
Could you help me?
Thanks
There is an overload of Eval that takes three parameters (the link also contains a sample):
Container
Expression
Format
For the format, you'd specify "{0:c}" or whatever format you like. For a list of the Standard Numeric Format Strings, see this link. If you want to specify your format with a custom format string, e.g. use "{0:#,##0.00}".
You can use the ToString() extension
var value = 1234567.99;
Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));
Or by stating your culture
Console.WriteLine(value.ToString("C3", CultureInfo.CreateSpecificCulture("sv-SE")));

No Way to Format Cell as Month-Date-Year in PHPExcel?

I've am trying to format cells in an Excel document I create with PHPExcel using the setFormatCode method. I've been going through the list of 'FORMAT_DATE_xxxxxxx' options associated with this method, but I've been unable to find one that lists the month, date, and year in that order. Did I miss something here?
You missed FORMAT_DATE_XLSX14 and FORMAT_DATE_XLSX22
You also missed the fact that these are simply predefined string values, and that you can use any valid Excel numberformat string value that you set yourself.
$objPHPExcel->getActiveSheet()->getStyle('C9')
->getNumberFormat()
->setFormatCode(
'mm-dd-yyyy' // my own personal preferred format that isn't predefined
);

Format string at runtime

I'm creating a html table at runtime (no probs there), and I would like to be able to format the content in the cells at runtime by passing in a format string (ie currencies, decimals, decimal places etc)
for example, i want to achieve something like this but to be able to pass in the format of the string with code as a string, ie "{0:c}" or "#,###,###"
ideally to be able to pass it into the ToString() method ( i can't do that but was wondering if there could be a clever way to achieve this?)
tblCell.Text = dt.Rows[i][j].ToString(#.##);
tblCell.Text = String.Format("{0:c}", dt.Rows[i][j])
and
tblCell.Text = String.Format("{0:#.##}", dt.Rows[i][j])
should work.
You can supply format strings to the columns in your GridView by setting the DataFormatString property of the column to something like this: “{0:d}”.
Have a look at:
http://www.cheat-sheets.org/saved-copy/msnet-formatting-strings.pdf
I always use this cheat sheet to find out things like these as the number of possibilities is simply to big to remember them all

How can I convert a datetime to dd-mmm-yyyy Date format?

I'm using Webdatechooser<<Infragistics control>> for a column which takes the datetime.
I need to convert the value entered (through the Webdatechooser) to dd-mmm-format.
Can I have snippets for that?
The value is a DateTime object so you can use the ToString function of that object to generate the desired output.
((DateTime)WebDateChooser1.Value).ToString("dd-MMM-yyyy");
Should do it.

Resources