Premahari
8th May 2018, 18:06
Hi, I want to print date which should print depends on user format. For example if i'm using dd/mm/yy date should print like 01.12.19. If another user using date format yy/mm/dd. When that user prints it should print like 19.12.01. How to print the date format as depends on user. Anyone please help.
mark_h
9th May 2018, 15:29
How do you know which user is using which date? Are you talking the client setup?
Premahari
10th May 2018, 07:34
Thanks for your reply. Yes I don know which user is using which format. But when they give print it should print in the format they are using. How to to do this?
Ajesh
10th May 2018, 08:39
Are you going to Maintain a specific Table for this ? If yes then you will need to maintain those formats in a Table for that.
like
User1 | 001
User2 | 002
User3 | 003
where the Display Format would refer to session ttadv4580m000
and then in the script what you need to change
result = sprintf$("%D" & user.format, input.date)
where user.format is the selected Date Format of the specific User.
mark_h
10th May 2018, 16:05
I do not see anyway around doing something like Ajesh recommended. I assume there is a windows date command you could run to a file on the client - then read that file, and create the table for that user. But still I think you could need the script format changes.
Premahari
5th June 2018, 13:40
Hi thanks for your reply,
But I don understand how to print date as per user region. For example if iam printing from india , following dd/mm/yy then it should print in dd/mm/yy.
If somone from china printing, they are following yy/mm/dd. So based on their region it should print yy/mm/dd. Can anyone please explain how to do this?
Ajesh
6th June 2018, 06:20
You Need to map somewhere the relation between Country and date formats..once mapped you need to display the formats using sprintf$
Premahari
6th June 2018, 07:02
Hi Ajesh,
Thanks for ur reply. Can u please tell how to map the country and format, and how to use format using printf.
bdittmar
6th June 2018, 09:26
Hello,
refer to DEV-Guide or search the Forum for using sprintf$().
http://www.baanboard.com/programmers_manual_baanerp_help_functions_formatting_io_sprintf
It's discussed an explained a lot of times.
Date-Format is maintained with session ttadv4580m000
Regards
Premahari
6th July 2018, 12:49
Hi thanks Bernd, But i tried everything using sprintf it's not working.Can u tell format i want to print in excel yyyy-mm-dd.
bdittmar
6th July 2018, 13:07
Hello,
sprintf$() Examples :
date.field = sprintf$("%u001", tisfc001.pldt)
date.field = sprintf$("%u(%02d.%02m.%04Y)",tssoc200.ordt) -> DD.MM.YYYY
date.field = sprintf$("%u(%04Y-%02m.%02d)",tssoc200.ordt) -> YYYY-MM-DD
Regards
Premahari
6th July 2018, 13:16
Hi thanks for your reply.I tried temp.date = sprintf$("%u(%04Y-%02m.%02d)",tdsls406.dldt). The output comes in the format 2018-07.06. But i want in format 2018-07-06.
So i just modified your to temp.date = sprintf$("%u(%04Y-%02m-%02d)",tdsls406.dldt). After that iam getting 06-07-2018. Still its not coming.
bdittmar
6th July 2018, 13:24
Hi thanks for your reply.I tried temp.date = sprintf$("%u(%04Y-%02m.%02d)",tdsls406.dldt). The output comes in the format 2018-07.06. But i want in format 2018-07-06.
So i just modified your to temp.date = sprintf$("%u(%04Y-%02m-%02d)",tdsls406.dldt). After that iam getting 06-07-2018. Still its not coming.
Hello,
temp.date = sprintf$("%u(%04Y-%02m-%02d)",tdsls406.dldt)
Should give : YYYY-MM-DD (Year-Month-Day)
Regards
Premahari
6th July 2018, 13:27
No I tried already Its printing in dd-mm-yyyy format. I don know why? Iam printing in Excel. Can tell any other options?
bdittmar
6th July 2018, 14:10
Hello,
Excel detected the field as date and reformate it.
Give the field as text to Excel and you'll get the proper result.
"'" & sprintf$("%u(%04Y-%02m-%02d)",last.mod.date)
'2016-12-01
'2015-02-09
'2016-11-28
'2016-11-23
'2015-09-24
'2016-01-12
'2015-12-07
'2017-12-01
otherwise it's shown in XLS Dateformat.
> put a character in front of the date <
Regards
Premahari
6th July 2018, 14:17
Hi Bernd Thnk u so much for you reply. But I don want to print anything before date. Let me try to find any other options, If you know please let me know.
bdittmar
6th July 2018, 14:29
Hi Bernd Thnk u so much for you reply. But I don want to print anything before date. Let me try to find any other options, If you know please let me know.
Hello,
by Default xls takes the date and time Format from Windows (Region and Language).
Maybe a 'BLANK' in front of the date can be used.
Otherwise Change the OS settings if possible.
Regards